fixed minor error in the write_to_file program