added a common destructor to class Problem