fix outfile bug