Output file saving fixed