fixed copying output from wrong file