also fix the read_file and write_file