Fixing 'Type mismatch' exception in destroy in IE11