Ok, I was worried you might be doing something non-standard. This is my normal solution to this kind of problem:
if [ "$1"="" ] ; then
find $start_folder -type f -printf "%f\n" > file1.tmp
cat file1.tmp|uniq > file2.tmp
for line in `cat file2.tmp` # problem starts here as the for loop treats the space as a delimiter
count=`grep -x "$line" file1.tmp|wc -l`
echo $line $count >> file3.tmp
sort -k 2nr -k 1 file3.tmp | cut -d " " -f1 | head
As a very quick explanation, the IFS variable defines what characters act as delimiters. So the lines in red simply store the normal value, replace that list with the newline as the only delimiter, do your processing, and restore the old value.
Also, the reason you need to surround $line in double quotes is for a similar reason. If your files contain spaces, grep can't know when your expression ends and filename(s) begin.