Fixed write file