fix a dtor bug in ref_