fix NullPointerException when an EOFException occurs