adding handlers for opstate ext_ref and cleanup