trying to solve file reading bug