cut done  add a update_metadata helper function used in write and cut