fix file reading bug