Found a little problem with writing to output files.