fixed file reading bug