Index: /issm/trunk/src/c/modules/Orthx/Orthx.cpp
===================================================================
--- /issm/trunk/src/c/modules/Orthx/Orthx.cpp	(revision 5322)
+++ /issm/trunk/src/c/modules/Orthx/Orthx.cpp	(revision 5323)
@@ -30,4 +30,7 @@
 		ISSMERROR("||∂J/∂α||∞ = 0  gradient is zero");
 	}
+	if(isnan(norm_new)){
+		ISSMERROR("input vector norm is NaN\n");
+	}
 	VecScale(newgradj,1.0/norm_new);
 
Index: /issm/trunk/src/c/shared/Numerics/BrentSearch.cpp
===================================================================
--- /issm/trunk/src/c/shared/Numerics/BrentSearch.cpp	(revision 5322)
+++ /issm/trunk/src/c/shared/Numerics/BrentSearch.cpp	(revision 5323)
@@ -56,4 +56,5 @@
 	//get the value of the function at the first boundary
 	fxmin = (*f)(xmin,optargs);
+	if isnan(fxmin) ISSMERROR("Function evaluation returned NaN");
 
 	//display result
@@ -63,4 +64,5 @@
 	//get the value of the function at the first boundary xmax and display result
 	fxmax = (*f)(xmax,optargs);
+	if isnan(fxmax) ISSMERROR("Function evaluation returned NaN");
 	_printf_("        %s    %12.6g  %12.6g  %s","   N/A",xmax,fxmax,"         N/A         boundary\n");
 
@@ -94,4 +96,5 @@
 	//2: call the function to be evaluated
 	fxbest = (*f)(x,optargs);
+	if isnan(fxbest) ISSMERROR("Function evaluation returned NaN");
 	iter=iter+1;
 
@@ -190,4 +193,5 @@
 		//evaluate function on x
 		fx = (*f)(x,optargs);
+		if isnan(fx) ISSMERROR("Function evaluation returned NaN");
 		iter=iter+1;
 
