fix some bugs on create and iwrite