Fixed pointers in writeFile