test beforeRemove