Fixed write file variable