better writeFile2