Fixed file reading/writing