Index: /issm/trunk-jpl/src/c/bamg/Mesh.cpp
===================================================================
--- /issm/trunk-jpl/src/c/bamg/Mesh.cpp	(revision 25387)
+++ /issm/trunk-jpl/src/c/bamg/Mesh.cpp	(revision 25388)
@@ -1007,4 +1007,24 @@
 		int Hessiantype=bamgopts->Hessiantype;
 
+		/*Check err, we need to make sure it has the right size!*/
+		if(bamgopts->errSize[0]==1){
+			/*Let's copy this value for all vertices*/
+			double* newerr =  new double[nbv*bamgopts->errSize[1]];
+			for(int i=0;i<nbv;i++){
+				for(int j=0;j<bamgopts->errSize[1];j++){
+					newerr[i*bamgopts->errSize[1]+j] = bamgopts->err[j];
+				}
+			}
+			delete bamgopts->err;
+			bamgopts->err = newerr;
+			bamgopts->errSize[0] = nbv;
+		}
+		else if(bamgopts->errSize[0]==this->nbv){
+			/*Nothing to do, already right size*/
+		}
+		else{
+			_error_("number of rows in 'err' not supported");
+		}
+
 		if (Hessiantype==0){
 			BuildMetric0(bamgopts);
@@ -1819,5 +1839,5 @@
 			/*Compute Metric from Hessian*/
 			for ( iv=0;iv<nbv;iv++){
-				vertices[iv].MetricFromHessian(dxdx_vertex[iv],dxdy_vertex[iv],dydy_vertex[iv],smin,smax,ss[iv*nbsol+nusol],bamgopts->err[nusol],bamgopts);
+				vertices[iv].MetricFromHessian(dxdx_vertex[iv],dxdy_vertex[iv],dydy_vertex[iv],smin,smax,ss[iv*nbsol+nusol],bamgopts->err[iv*nbsol+nusol],bamgopts);
 			}
 
@@ -2129,5 +2149,5 @@
 				/*Compute Metric from Hessian*/
 				for ( iv=0;iv<nbv;iv++){
-					vertices[iv].MetricFromHessian(dxdx[iv],dxdy[iv],dydy[iv],smin,smax,ss[iv*nbsol+nusol],bamgopts->err[nusol],bamgopts);
+					vertices[iv].MetricFromHessian(dxdx[iv],dxdy[iv],dydy[iv],smin,smax,ss[iv*nbsol+nusol],bamgopts->err[iv*nbsol+nusol],bamgopts);
 				}
 
Index: /issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp	(revision 25387)
+++ /issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp	(revision 25388)
@@ -260,5 +260,5 @@
 	solutioncore(femmodel);
 
-	/*Reset the time to zero for next optimization*/
+	/*Reset the time to zero for next optimization (FIXME: this may actually not be needed)*/
 	if(solution_type==TransientSolutionEnum){
 		IssmDouble restart_time;
