Solution class memory deallocation fix