fixed output to both file and screen