A small fix for the improved iterate_to_file code.