Index: /issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp	(revision 25557)
+++ /issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp	(revision 25558)
@@ -281,6 +281,8 @@
 	codi_global.output_indices.clear();
 	#endif
+	int i=-1;
 	for(Object* & object:dependent_objects->objects){
-		DependentObject* dep=(DependentObject*)object;
+		i++;
+		DependentObject* dep=xDynamicCast<DependentObject*>(object);
 		if(solution_type==TransientSolutionEnum) output_value = dep->GetValue();
 		if(solution_type!=TransientSolutionEnum) dep->Responsex(&output_value,femmodel);
@@ -474,15 +476,14 @@
 
 	/*Intermediaries*/
-	long         omode;
-	double		 f;
-	double		 dxmin,gttol;
-	int          maxsteps,maxiter;
-	int          intn,num_controls,num_cost_functions,solution_type;
-	double*      scaling_factors = NULL;
-	double      *X  = NULL;
-	double      *G  = NULL;
-	int*			N	= NULL;
-   int*			M	= NULL;
-	int* control_enum;
+	long    omode;
+	double  f,dxmin,gttol;
+	int     maxsteps,maxiter;
+	int     intn ,num_controls,num_cost_functions,solution_type;
+	double *scaling_factors = NULL;
+	double *X               = NULL;
+	double *G               = NULL;
+	int    *N               = NULL;
+	int    *M               = NULL;
+	int    *control_enum;
 
 	/*Recover some parameters*/
@@ -631,5 +632,5 @@
 		femmodel->results->AddObject(new GenericExternalResult<IssmPDouble*>(femmodel->results->Size()+1,JEnum,mystruct.Jlist,(*mystruct.i),mystruct.N,0,0));
 
-	femmodel->OutputControlsx(&femmodel->results);
+		femmodel->OutputControlsx(&femmodel->results);
 	}
 
Index: /issm/trunk-jpl/src/c/cores/controlvalidation_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/controlvalidation_core.cpp	(revision 25557)
+++ /issm/trunk-jpl/src/c/cores/controlvalidation_core.cpp	(revision 25558)
@@ -217,6 +217,8 @@
 	dependents=xNew<IssmPDouble>(num_dependents);
 	codi_global.output_indices.clear();
+	int i=-1;
 	for(Object* & object:dependent_objects->objects){
-		DependentObject* dep=(DependentObject*)object
+		DependentObject* dep=xDynamicCast<DependentObject*>(object);
+		i++;
 		if(solution_type==TransientSolutionEnum){
 			output_value = dep->GetValue();
@@ -293,5 +295,5 @@
 		j=0.;
 		for(Object* & object:dependent_objects->objects){
-			DependentObject* dep=(DependentObject*)object
+			DependentObject* dep=xDynamicCast<DependentObject*>(object);
 			if(solution_type==TransientSolutionEnum){
 				output_value = dep->GetValue();
