attempting memory deallocation fixes