simplified dump_to_file