Correct output file bug