Correcting a bug saving result file