Fixed the destructor bug