fix 2 eof-related bugs in scanf