Index: branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCM_MinimizeChisq.c
===================================================================
--- branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCM_MinimizeChisq.c	(revision 28692)
+++ branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCM_MinimizeChisq.c	(revision 28702)
@@ -291,4 +291,6 @@
 
     // convolve model and dmodel arrays with PSF
+    // XXX speed this up by saving the FFTed psf (for each source, obviously)
+
     psImageConvolveDirect (pcm->modelConvFlux, pcm->modelFlux, pcm->psf);
     for (int n = 0; n < pcm->dmodelsFlux->n; n++) {
Index: branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCMdata.c
===================================================================
--- branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCMdata.c	(revision 28692)
+++ branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCMdata.c	(revision 28702)
@@ -141,12 +141,16 @@
 }
 
-pmPCMdata *pmPCMinit(pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, float psfSize) {
-
-    // make sure we savep a cached copy of the psf flux
+pmPCMdata *pmPCMinit(pmSource *source, pmSourceFitOptions *fitOptions, pmModel *model, psImageMaskType maskVal, float psfSize) {
+
+    // make sure we save a cached copy of the psf flux
     pmSourceCachePSF (source, maskVal);
 
     // convert the cached cached psf model for this source to a psKernel
     psKernel *psf = pmPCMkernelFromPSF (source, psfSize);
-    if (!psf) return NULL;
+    if (!psf) {
+	// NOTE: this only happens if the source is too close to an edge
+        model->flags |= PM_MODEL_STATUS_BADARGS;
+	return NULL;
+    }
 
 # if (USE_DELTA_PSF)
@@ -154,11 +158,4 @@
     psf->image->data.F32[(int)(0.5*psf->image->numRows)][(int)(0.5*psf->image->numCols)] = 1.0;
 # endif
-
-    // allocate the model
-    pmModel *modelConv = pmModelAlloc(modelType);
-    if (!modelConv) {
-	psFree (psf);
-	return NULL;
-    }
 
     // count the number of unmasked pixels:
@@ -183,10 +180,10 @@
     }    
 
-    psVector *params  = modelConv->params;
+    psVector *params  = model->params;
 
     // create the minimization constraints
     psMinConstraint *constraint = psMinConstraintAlloc();
     constraint->paramMask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK);
-    constraint->checkLimits = modelConv->modelLimits;
+    constraint->checkLimits = model->modelLimits;
 
     // set parameter mask based on fitting mode
@@ -239,17 +236,19 @@
     }
 
+    if (nPix <  nParams + 1) {
+        psTrace ("psModules.objects", 4, "insufficient valid pixels\n");
+	psFree (psf);
+	psFree (constraint);
+        model->flags |= PM_MODEL_STATUS_BADARGS;
+	return NULL;
+    }
+
     // generate PCM data storage structure
     pmPCMdata *pcm = pmPCMdataAlloc (params, constraint->paramMask, source);
 
-    pcm->modelConv = modelConv;
     pcm->psf = psf;
+    pcm->modelConv = psMemIncrRefCounter(model);
     pcm->constraint = constraint;
 
-    if (nPix <  nParams + 1) {
-        psTrace ("psModules.objects", 4, "insufficient valid pixels\n");
-        pcm->modelConv->flags |= PM_MODEL_STATUS_BADARGS;
-	abort ();
-	// XXX This should not be an abort!!
-    }
     pcm->nPix = nPix;
     pcm->nDOF = nPix - nParams - 1;
Index: branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCMdata.h
===================================================================
--- branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCMdata.h	(revision 28692)
+++ branches/eam_branches/ipp-20100621/psModules/src/objects/pmPCMdata.h	(revision 28702)
@@ -61,5 +61,5 @@
     pmSource *source);
 
-pmPCMdata *pmPCMinit(pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, float psfSize);
+pmPCMdata *pmPCMinit(pmSource *source, pmSourceFitOptions *fitOptions, pmModel *model, psImageMaskType maskVal, float psfSize);
 
 psImage *pmPCMdataSaveImage (pmPCMdata *pcm);
