Fix outputting file