modify write_record