fixed another bug with end of file