changed the way EOF was handled