Fixed a bug in .destroy() function.