Index: /trunk/psphot/src/psphotEnsemblePSF.c
===================================================================
--- /trunk/psphot/src/psphotEnsemblePSF.c	(revision 6948)
+++ /trunk/psphot/src/psphotEnsemblePSF.c	(revision 6949)
@@ -29,5 +29,5 @@
     psArray  *models = psArrayAlloc (sources->n);
     psVector *index  = psVectorAlloc (sources->n, PS_TYPE_U32);
-    models->n = index->n = 0;
+    // DROP models->n = index->n = 0;
 
     // option to limit analysis to a specific region
@@ -170,5 +170,5 @@
 
     psSparseConstraint constraint;
-    constraint.paramMin   = 0;
+    constraint.paramMin   = 0.0;
     constraint.paramMax   = 1e8;
     constraint.paramDelta = 1e8;
@@ -191,4 +191,7 @@
 
 	// assign linearly-fitted normalization
+	if (isnan(norm->data.F32[i])) {
+	    psAbort ("psphot", "ensemble source is nan");
+	}
 	Fi->modelPSF->params->data.F32[1] = norm->data.F32[i];
 	Fi->modelPSF->dparams->data.F32[1] = sqrt(sqrt(2) * norm->data.F32[i] / (sparse->Bfj->data.F32[i] * weight->data.F32[i]));
Index: /trunk/psphot/src/psphotSourceFits.c
===================================================================
--- /trunk/psphot/src/psphotSourceFits.c	(revision 6948)
+++ /trunk/psphot/src/psphotSourceFits.c	(revision 6949)
@@ -10,4 +10,5 @@
     // save the PSF model from the Ensemble fit
     pmModel *PSF = pmModelCopy (source->modelPSF);
+    if (isnan(PSF->params->data.F32[1])) psAbort ("psphot", "nan in psf fit");
 
     // extend source radius as needed
@@ -191,7 +192,8 @@
     PSF = source->modelPSF;
     psphotCheckRadiusPSFBlend (readout, source, PSF, 8.0);
+    if (isnan(PSF->params->data.F32[1])) psAbort ("psphot", "nan in dbl fit");
 
     modelSet = psArrayAlloc (2);
-    modelSet->n = 0;
+    // DROP modelSet->n = 0;
 
     DBL = pmModelCopy (PSF);
@@ -224,4 +226,5 @@
     // use the source moments, etc to guess basic model parameters
     pmModel *EXT = pmSourceModelGuess (source, modelTypeEXT); 
+    // if (isnan(EXT->params->data.F32[1])) psAbort ("psphot", "nan in ext fit");
 
     psphotCheckRadiusEXT (readout, source, EXT);
@@ -229,4 +232,8 @@
     x = EXT->params->data.F32[2];
     y = EXT->params->data.F32[3];
+
+    if ((source->moments->Sx < 1e-3) || (source->moments->Sx < 1e-3)) {
+	psTrace ("psphotSourceFits", 5, "problem source: moments: %f %f\n", source->moments->Sx, source->moments->Sy);
+    }
 
     // fit EXT (not PSF) model (set/unset the pixel mask)
@@ -251,4 +258,5 @@
     // save the PSF model from the Ensemble fit
     pmModel *PSF = pmModelCopy (source->modelPSF);
+    if (isnan(PSF->params->data.F32[1])) psAbort ("psphot", "nan in blend fit primary");
 
     x = PSF->params->data.F32[2];
@@ -256,9 +264,9 @@
 
     psArray *modelSet = psArrayAlloc (source->blends->n + 1);
-    modelSet->n = 0;
+    // DROP modelSet->n = 0;
     psArrayAdd (modelSet, 16, PSF);
     
     psArray *sourceSet = psArrayAlloc (source->blends->n + 1);
-    sourceSet->n = 0;
+    // DROP sourceSet->n = 0;
     psArrayAdd (sourceSet, 16, source);
 
@@ -282,4 +290,5 @@
 	// XXX assume local sky is 0.0?
 	model->params->data.F32[1] = blend->moments->Peak - blend->moments->Sky;
+	if (isnan(model->params->data.F32[1])) psAbort ("psphot", "nan in blend fit");
 	model->params->data.F32[2] = blend->peak->x;
 	model->params->data.F32[3] = blend->peak->y;
