fix some write error