Fixed wrong exit code in case of optimization problems.
Removed some warnings.