writeFile fix