Index: trunk/psModules/src/astrom/pmAstrometryObjects.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryObjects.c	(revision 31153)
+++ trunk/psModules/src/astrom/pmAstrometryObjects.c	(revision 31671)
@@ -996,5 +996,5 @@
             newStat->center = center;
 
-            if (isfinite(newStat->minMetric) && (newStat->minMetric > 0.0) && (newStat->minMetric < minStat->minMetric)) {
+            if (isfinite(newStat->minMetric) && (newStat->minMetric > 0.0) && (newStat->nSigma >= minSigma) && (newStat->minMetric < minStat->minMetric)) {
                 *minStat = *newStat;
                 psLogMsg ("psModule.astrom", 4, "grid test - offset: %7.2f,%7.2f @ %6.1f deg x %7.3f (%4d pts, %5.1f sig, %5.1f var, %6.3f log metric) *",
@@ -1080,4 +1080,8 @@
     psVector *xHistNew = psVectorSmooth(NULL, xHist, tweakSmooth, tweakNsigma);
     psVector *yHistNew = psVectorSmooth(NULL, yHist, tweakSmooth, tweakNsigma);
+
+    // if we failed to smooth, just use the original vector (probably too narrow a range)
+    if (!xHistNew) xHistNew = psMemIncrRefCounter (xHist);
+    if (!yHistNew) yHistNew = psMemIncrRefCounter (yHist);
 
     // select peak in x and in y
