Fix destroy function