Adapted destroy function to support `extend`.