Fixed up implem. of output file