Is the program not reading some lines from the file? Print out the lines as they are read so you can see which lines are not being read.