fixing eof error