Fixed a deallocation bug