working on write_file