diff --git a/mot/cl_routines/optimizing/base.py b/mot/cl_routines/optimizing/base.py
index <HASH>..<HASH> 100644
--- a/mot/cl_routines/optimizing/base.py
+++ b/mot/cl_routines/optimizing/base.py
@@ -376,8 +376,14 @@ class AbstractParallelOptimizerWorker(Worker):
                 ''' + param_modifier.get_name() + '''((void*)&data, x_model);
                 
                 double sum = 0;
+                double objective = 0;
                 for(uint i = 0; i < ''' + str(self._model.get_nmr_inst_per_problem()) + '''; i++){
-                    sum += pown(''' + objective_function.get_name() + '''(data, x_model, i), 2);
+                    objective = ''' + objective_function.get_name() + '''(data, x_model, i);
+                        
+                    if(isinf(objective)){
+                        return HUGE_VAL;
+                    }   
+                    sum += pown(objective, 2);
                 }
                 return sum;
             }
Small update to allow the model to signal for bounds