file reading fixes