fix code output to file