fixed output to file