fix bug on file reading