Index: /issm/trunk-jpl/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Elements/Tria.cpp	(revision 12271)
+++ /issm/trunk-jpl/src/c/objects/Elements/Tria.cpp	(revision 12272)
@@ -629,5 +629,8 @@
 		basal_melting_input->GetInputValue(&basal_melting_g,gauss);
 		thickness_input->GetInputValue(&thickness_g,gauss);
-		if(basal_melting_correction_input) basal_melting_correction_input->GetInputValue(&basal_melting_correction_g,gauss);
+		if(basal_melting_correction_input)
+		 basal_melting_correction_input->GetInputValue(&basal_melting_correction_g,gauss);
+		else
+		 basal_melting_correction_g=0.;
 
 		for(i=0;i<numdof;i++) pe->values[i]+=Jdettria*gauss->weight*(thickness_g+dt*(surface_mass_balance_g-basal_melting_g-basal_melting_correction_g))*L[i];
Index: /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp	(revision 12271)
+++ /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp	(revision 12272)
@@ -166,4 +166,7 @@
 	double* localvalues=NULL;
 
+	/*In debugging mode, check consistency (no NaN, and values not too big)*/
+	this->CheckConsistency();
+
 	if(this->fsize){
 		/*first, retrieve values that are in the f-set from the g-set values vector: */
@@ -200,4 +203,15 @@
 	}
 
+}
+/*}}}*/
+/*FUNCTION ElementVector::CheckConsistency{{{1*/
+void ElementVector::CheckConsistency(void){
+	/*Check element matrix values, only in debugging mode*/
+#ifdef _ISSM_DEBUG_ 
+	for (int i=0;i<this->nrows;i++){
+		if (isnan(this->values[i])) _error_("NaN found in Element Vector");
+		if (fabs( this->values[i])>1.e+50) _error_("Element Vector values exceeds 1.e+50");
+	}
+#endif
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.h
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.h	(revision 12271)
+++ /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.h	(revision 12272)
@@ -43,4 +43,5 @@
 		void InsertIntoGlobal(Vector* pf);
 		void Echo(void);
+		void CheckConsistency(void);
 		void Init(ElementVector* pe);
 		void SetValue(double scalar);
