Fix problem with writeToFile: and nil name