fix FreeProblem(), now it checks before delete pointers
Merge branch 'hotfix/fix_freeproblem'