Fixed bug in deallocation methods.