fixes that write error