Solved the deallocation problem in certain multithreaded operations