fixed bug in write-output_file)