Fixed write problem