fix writeFile()