Index: /tags/ipp-20101206/psLib/src/imageops/psImageMapFit.c
===================================================================
--- /tags/ipp-20101206/psLib/src/imageops/psImageMapFit.c	(revision 30045)
+++ /tags/ipp-20101206/psLib/src/imageops/psImageMapFit.c	(revision 30046)
@@ -48,10 +48,10 @@
 
 // map defines the output image dimensions and scaling.
-bool psImageMapFit(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
+bool psImageMapFit(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
                    const psVector *x, const psVector *y, const psVector *f, const psVector *df)
 {
     // XXX Add Asserts
 
-    *goodFit = false;
+    *pGoodFit = false;
 
     // dimensions of the output map image
@@ -83,5 +83,5 @@
         map->map->data.F32[0][0]   = psStatsGetValue(map->stats, mean);
         map->error->data.F32[0][0] = psStatsGetValue(map->stats, stdev);
-	*goodFit = true;
+	*pGoodFit = true;
         return true;
     }
@@ -89,10 +89,10 @@
     if (Nx == 1) {
         bool status;
-        status = psImageMapFit1DinY (goodFit, map, mask, maskValue, x, y, f, df);
+        status = psImageMapFit1DinY (pGoodFit, map, mask, maskValue, x, y, f, df);
         return status;
     }
     if (Ny == 1) {
         bool status;
-        status = psImageMapFit1DinX (goodFit, map, mask, maskValue, x, y, f, df);
+        status = psImageMapFit1DinX (pGoodFit, map, mask, maskValue, x, y, f, df);
         return status;
     }
@@ -339,10 +339,10 @@
     psFree (Empty);
 
-    *goodFit = true;
+    *pGoodFit = true;
     return true;
 }
 
 // measure residuals on each pass and clip outliers based on stats
-bool psImageMapClipFit(bool *goodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,
+bool psImageMapClipFit(bool *pGoodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,
                        const psVector *x, const psVector *y, const psVector *f, const psVector *df)
 {
@@ -354,5 +354,5 @@
     psAssert(f, "impossible");
 
-    *goodFit = false;
+    *pGoodFit = false;
 
     // the user supplies one of various stats option pairs,
@@ -398,5 +398,5 @@
         psTrace("psLib.imageops", 6, "Loop iteration %d.  Calling psImageMapFit()\n", N);
         psS32 Nkeep = 0;
-        if (!psImageMapFit(goodFit, map, mask, maskValue, x, y, f, df)) {
+        if (!psImageMapFit(pGoodFit, map, mask, maskValue, x, y, f, df)) {
             psError(PS_ERR_UNKNOWN, false, "Could not fit image map.\n");
             psFree(resid);
@@ -404,5 +404,5 @@
             return false;
         }
-	if (!goodFit) {
+	if (!*pGoodFit) {
 	    psWarning ("bad fit to image map, try something else");
 	    return true;
@@ -463,10 +463,10 @@
     psFree(resid);
     if (!inMask) psFree (mask);
-    *goodFit = true; // XXX probably don't need to set this (set by psImageMapFit)
+    *pGoodFit = true; // XXX probably don't need to set this (set by psImageMapFit)
     return true;
 }
 
 // map defines the output image dimensions and scaling.
-bool psImageMapFit1DinY(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
+bool psImageMapFit1DinY(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
                         const psVector *x, const psVector *y, const psVector *f, const psVector *df)
 {
@@ -474,5 +474,5 @@
     assert (map->binning->nXruff == 1);
 
-    *goodFit = false;
+    *pGoodFit = false;
 
     // dimensions of the output map image
@@ -613,10 +613,10 @@
     psFree (Empty);
 
-    *goodFit = true;
+    *pGoodFit = true;
     return true;
 }
 
 // map defines the output image dimensions and scaling.
-bool psImageMapFit1DinX(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
+bool psImageMapFit1DinX(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
                         const psVector *x, const psVector *y, const psVector *f, const psVector *df)
 {
@@ -624,5 +624,5 @@
     assert (map->binning->nYruff == 1);
 
-    *goodFit = false;
+    *pGoodFit = false;
 
     // dimensions of the output map image
@@ -763,5 +763,5 @@
     psFree (Empty);
 
-    *goodFit = true;
+    *pGoodFit = true;
     return true;
 }
Index: /tags/ipp-20101206/psLib/src/imageops/psImageMapFit.h
===================================================================
--- /tags/ipp-20101206/psLib/src/imageops/psImageMapFit.h	(revision 30045)
+++ /tags/ipp-20101206/psLib/src/imageops/psImageMapFit.h	(revision 30046)
@@ -8,5 +8,5 @@
 
 // fit the image map to a set of points
-bool psImageMapFit(bool *goodFit, 
+bool psImageMapFit(bool *pGoodFit, 
 		   psImageMap *map,
                    const psVector *mask,
@@ -19,5 +19,5 @@
 
 // fit the image map to a set of points
-bool psImageMapClipFit(bool *goodFit, 
+bool psImageMapClipFit(bool *pGoodFit, 
 		       psImageMap *map,
                        psStats *stats,
@@ -30,5 +30,5 @@
     );
 
-bool psImageMapFit1DinY(bool *goodFit, 
+bool psImageMapFit1DinY(bool *pGoodFit, 
 			psImageMap *map,
                         const psVector *mask,
@@ -40,5 +40,5 @@
     );
 
-bool psImageMapFit1DinX(bool *goodFit, 
+bool psImageMapFit1DinX(bool *pGoodFit, 
 			psImageMap *map,
                         const psVector *mask,
Index: /tags/ipp-20101206/psLib/src/types/psMetadata.c
===================================================================
--- /tags/ipp-20101206/psLib/src/types/psMetadata.c	(revision 30045)
+++ /tags/ipp-20101206/psLib/src/types/psMetadata.c	(revision 30046)
@@ -1371,5 +1371,5 @@
             break;
         case PS_DATA_S64:
-            fprintf(fd, "%jd\n", item->data.S64);
+            fprintf(fd, "%" PRId64 "\n", item->data.S64);
             break;
         case PS_DATA_U8:
@@ -1383,5 +1383,5 @@
             break;
         case PS_DATA_U64:
-            fprintf(fd, "%ju\n", item->data.U64);
+            fprintf(fd, "%" PRIu64 "\n", item->data.U64);
             break;
         case PS_DATA_F32:
@@ -1458,5 +1458,5 @@
               fprintf(fd, "U64  ");
               for (int i = 0; i < vector->n; i++) {
-                  fprintf(fd, "%ju ", vector->data.U64[i]);
+                  fprintf(fd, "%" PRIu64, vector->data.U64[i]);
               }
               fprintf(fd, "\n");
@@ -1486,5 +1486,5 @@
               fprintf(fd, "S64  ");
               for (int i = 0; i < vector->n; i++) {
-                  fprintf(fd, "%jd ", vector->data.S64[i]);
+                  fprintf(fd, "%" PRId64, vector->data.S64[i]);
               }
               fprintf(fd, "\n");
Index: /tags/ipp-20101206/psModules/src/camera/pmFPAfile.c
===================================================================
--- /tags/ipp-20101206/psModules/src/camera/pmFPAfile.c	(revision 30045)
+++ /tags/ipp-20101206/psModules/src/camera/pmFPAfile.c	(revision 30046)
@@ -36,5 +36,5 @@
         return;
     }
-    psTrace ("pmFPAfileFree", 5, "freeing %s %ld\n", file->name,(psU64) file->fits);
+    psTrace ("pmFPAfileFree", 5, "freeing %s %p\n", file->name, file->fits);
     psAssert(!fpaFileFreeStrict || file->fits == NULL, "File %s wasn't closed.", file->name);
 
Index: /tags/ipp-20101206/psModules/src/objects/pmPSF_IO.c
===================================================================
--- /tags/ipp-20101206/psModules/src/objects/pmPSF_IO.c	(revision 30045)
+++ /tags/ipp-20101206/psModules/src/objects/pmPSF_IO.c	(revision 30046)
@@ -62,4 +62,6 @@
 #include "pmSourceIO.h"
 
+bool pmPSFmodelReadPSFClump (psMetadata *analysis, psMetadata *header);
+
 bool pmPSFmodelCheckDataStatusForView (const pmFPAview *view, const pmFPAfile *file)
 {
@@ -851,65 +853,13 @@
 
     // read the psf clump data for each region
+    status = false;
     if (roAnalysis) {
-        int nRegions = psMetadataLookupS32 (&status, header, "PSF_CLN");
-        if (!status) {
-            // read old-style psf clump data
-
-            char regionName[64];
-            snprintf (regionName, 64, "PSF.CLUMP.REGION.000");
-            psMetadataAddS32 (roAnalysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS",  PS_META_REPLACE, "psf clump regions", 1);
-
-            psMetadata *regionMD = psMetadataLookupPtr (&status, roAnalysis, regionName);
-            if (!regionMD) {
-                regionMD = psMetadataAlloc();
-                psMetadataAddMetadata (roAnalysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD);
-                psFree (regionMD);
-            }
-
-            // psf clump data
-            pmPSFClump psfClump;
-
-            psfClump.X  = psMetadataLookupF32 (&status, header, "PSF_CLX" );  assert(status);
-            psfClump.Y  = psMetadataLookupF32 (&status, header, "PSF_CLY" );  assert(status);
-            psfClump.dX = psMetadataLookupF32 (&status, header, "PSF_CLDX");  assert(status);
-            psfClump.dY = psMetadataLookupF32 (&status, header, "PSF_CLDY");  assert(status);
-
-            psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X",  PS_META_REPLACE, "psf clump center", psfClump.X);
-            psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y",  PS_META_REPLACE, "psf clump center", psfClump.Y);
-            psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX);
-            psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY);
-        } else {
-            psMetadataAddS32 (roAnalysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS",  PS_META_REPLACE, "psf clump regions", nRegions);
-
-            for (int i = 0; i < nRegions; i++) {
-                char key[10];
-                char regionName[64];
-                snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", i);
-
-                psMetadata *regionMD = psMetadataLookupPtr (&status, roAnalysis, regionName);
-                if (!regionMD) {
-                    regionMD = psMetadataAlloc();
-                    psMetadataAddMetadata (roAnalysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD);
-                    psFree (regionMD);
-                }
-
-                // psf clump data
-                pmPSFClump psfClump;
-
-                snprintf (key, 9, "CLX_%03d", i);
-                psfClump.X  = psMetadataLookupF32 (&status, header, key);  assert(status);
-                snprintf (key, 9, "CLY_%03d", i);
-                psfClump.Y  = psMetadataLookupF32 (&status, header, key);  assert(status);
-                snprintf (key, 9, "CLDX_%03d", i);
-                psfClump.dX = psMetadataLookupF32 (&status, header, key);  assert(status);
-                snprintf (key, 9, "CLDY_%03d", i);
-                psfClump.dY = psMetadataLookupF32 (&status, header, key);  assert(status);
-
-                psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X",  PS_META_REPLACE, "psf clump center", psfClump.X);
-                psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y",  PS_META_REPLACE, "psf clump center", psfClump.Y);
-                psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX);
-                psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY);
-            }
-        }
+	status = pmPSFmodelReadPSFClump (roAnalysis, header);
+	if (!status) {
+	    psMetadataAddS32 (roAnalysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS",  PS_META_REPLACE, "psf clump regions", 0);
+	}
+    } 
+    if (!roAnalysis || !status) {
+	psWarning ("no PSF.CLUMP data available for PSF model");
     }
 
@@ -1123,3 +1073,66 @@
 }
 
-// XXX pmPSF to/from Metadata functions were defined for 1.22 and earlier, but were dropped
+bool pmPSFmodelReadPSFClump (psMetadata *analysis, psMetadata *header) {
+
+    bool status = false;;
+
+    int nRegions = psMetadataLookupS32 (&status, header, "PSF_CLN");
+    if (!status) {
+	// read old-style psf clump data
+
+	char regionName[64];
+	snprintf (regionName, 64, "PSF.CLUMP.REGION.000");
+	psMetadata *regionMD = psMetadataLookupPtr (&status, analysis, regionName);
+
+	if (!regionMD) {
+	    regionMD = psMetadataAlloc();
+	    psMetadataAddMetadata (analysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD);
+	    psFree (regionMD);
+	}
+
+	// psf clump data
+	pmPSFClump psfClump;
+	psfClump.X  = psMetadataLookupF32 (&status, header, "PSF_CLX" );  if (!status) return false;
+	psfClump.Y  = psMetadataLookupF32 (&status, header, "PSF_CLY" );  if (!status) return false;
+	psfClump.dX = psMetadataLookupF32 (&status, header, "PSF_CLDX");  if (!status) return false;
+	psfClump.dY = psMetadataLookupF32 (&status, header, "PSF_CLDY");  if (!status) return false;
+
+	psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X",  PS_META_REPLACE, "psf clump center", psfClump.X);
+	psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y",  PS_META_REPLACE, "psf clump center", psfClump.Y);
+	psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX);
+	psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY);
+	psMetadataAddS32 (analysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS",  PS_META_REPLACE, "psf clump regions", 1);
+    } else {
+	for (int i = 0; i < nRegions; i++) {
+	    char key[10];
+	    char regionName[64];
+	    snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", i);
+
+	    psMetadata *regionMD = psMetadataLookupPtr (&status, analysis, regionName);
+	    if (!regionMD) {
+		regionMD = psMetadataAlloc();
+		psMetadataAddMetadata (analysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD);
+		psFree (regionMD);
+	    }
+
+	    // psf clump data
+	    pmPSFClump psfClump;
+
+	    snprintf (key, 9, "CLX_%03d", i);
+	    psfClump.X  = psMetadataLookupF32 (&status, header, key);  if (!status) return false;
+	    snprintf (key, 9, "CLY_%03d", i);
+	    psfClump.Y  = psMetadataLookupF32 (&status, header, key);  if (!status) return false;
+	    snprintf (key, 9, "CLDX_%03d", i);
+	    psfClump.dX = psMetadataLookupF32 (&status, header, key);  if (!status) return false;
+	    snprintf (key, 9, "CLDY_%03d", i);
+	    psfClump.dY = psMetadataLookupF32 (&status, header, key);  if (!status) return false;
+
+	    psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X",  PS_META_REPLACE, "psf clump center", psfClump.X);
+	    psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y",  PS_META_REPLACE, "psf clump center", psfClump.Y);
+	    psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX);
+	    psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY);
+	}
+	psMetadataAddS32 (analysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS",  PS_META_REPLACE, "psf clump regions", nRegions);
+    }
+    return true;
+}
Index: /tags/ipp-20101206/psModules/src/objects/pmPSFtry.h
===================================================================
--- /tags/ipp-20101206/psModules/src/objects/pmPSFtry.h	(revision 30045)
+++ /tags/ipp-20101206/psModules/src/objects/pmPSFtry.h	(revision 30046)
@@ -100,5 +100,5 @@
 bool pmPSFtryFitEXT (pmPSFtry *psfTry, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType markVal);
 
-bool pmPSFtryMakePSF (bool *goodFit, pmPSFtry *psfTry);
+bool pmPSFtryMakePSF (bool *pGoodFit, pmPSFtry *psfTry);
 
 bool pmPSFtryFitPSF (pmPSFtry *psfTry, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType markVal);
@@ -123,5 +123,5 @@
 );
 
-bool pmPSFFitShapeParams (bool *goodFit, pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask);
+bool pmPSFFitShapeParams (bool *pGoodFit, pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask);
 
 float psVectorSystematicError (psVector *residuals, psVector *errors, float clipFraction);
Index: /tags/ipp-20101206/psModules/src/objects/pmPSFtryMakePSF.c
===================================================================
--- /tags/ipp-20101206/psModules/src/objects/pmPSFtryMakePSF.c	(revision 30045)
+++ /tags/ipp-20101206/psModules/src/objects/pmPSFtryMakePSF.c	(revision 30046)
@@ -50,5 +50,5 @@
 Note: some of the array entries may be NULL (failed fits); ignore them.
  *****************************************************************************/
-bool pmPSFtryMakePSF (bool *goodFit, pmPSFtry *psfTry)
+bool pmPSFtryMakePSF (bool *pGoodFit, pmPSFtry *psfTry)
 {
     PS_ASSERT_PTR_NON_NULL(psfTry, false);
@@ -74,10 +74,10 @@
 
     // fit the shape parameters (SXX, SYY, SXY) as a function of position
-    if (!pmPSFFitShapeParams (goodFit, psf, psfTry->sources, x, y, srcMask)) {
+    if (!pmPSFFitShapeParams (pGoodFit, psf, psfTry->sources, x, y, srcMask)) {
         psFree(x);
         psFree(y);
         return false;
     }
-    if (!goodFit) {
+    if (!*pGoodFit) {
 	psWarning ("poor fit to PSF shape parameters for trend order %d, %d, skipping\n", psf->trendNx, psf->trendNy);
 	psFree(x);
@@ -121,5 +121,5 @@
         // the mask is carried from previous steps and updated with this operation
         // the weight is either the flux error or NULL, depending on 'psf->poissonErrorParams'
-        if (!pmTrend2DFit (goodFit, trend, srcMask, 0xff, x, y, z, NULL)) {
+        if (!pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, z, NULL)) {
             psError(PS_ERR_UNKNOWN, false, "failed to build psf model for parameter %d", i);
             psFree(x);
@@ -128,5 +128,5 @@
             return false;
         }
-	if (!goodFit) {
+	if (!*pGoodFit) {
 	    // if we do not get a good fit (but do not actually hit an error), 
 	    // tell the calling program to try something else
@@ -154,4 +154,12 @@
 
             pmModel *modelPSF = pmModelFromPSF (source->modelEXT, psf);
+            if (!modelPSF) {
+                fprintf(f, "modelPSF is NULL\n");
+                break;
+            }
+            if (!source->modelEXT) {
+                fprintf(f, "source->modelEXT is NULL\n");
+                break;
+            }
 
             fprintf (f, "%f %f : ", source->modelEXT->params->data.F32[PM_PAR_XPOS], source->modelEXT->params->data.F32[PM_PAR_YPOS]);
@@ -178,5 +186,5 @@
 
 // fit the shape parameters using the supplied order (pmPSF->trendNx,trendNy)
-bool pmPSFFitShapeParams (bool *goodFit, pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask) {
+bool pmPSFFitShapeParams (bool *pGoodFit, pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask) {
 
     // we are doing a robust fit.  after each pass, we drop points which are more deviant than
@@ -234,6 +242,6 @@
 	trend = psf->params->data[PM_PAR_E0];
 	trend->stats->clipIter = 1; // in allocation, this value is set to the value of nIter, but we should use 1 here
-	status &= pmTrend2DFit (goodFit, trend, srcMask, 0xff, x, y, e0, NULL);
-	if (!goodFit) {
+	status &= pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, e0, NULL);
+	if (!*pGoodFit) {
 	    psFree (e0);
 	    psFree (e1);
@@ -249,6 +257,6 @@
 	trend = psf->params->data[PM_PAR_E1];
 	trend->stats->clipIter = 1; // in allocation, this value is set to the value of nIter, but we should use 1 here
-	status &= pmTrend2DFit (goodFit, trend, srcMask, 0xff, x, y, e1, NULL);
-	if (!goodFit) {
+	status &= pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, e1, NULL);
+	if (!*pGoodFit) {
 	    psFree (e0);
 	    psFree (e1);
@@ -264,6 +272,6 @@
 	trend = psf->params->data[PM_PAR_E2];
 	trend->stats->clipIter = 1; // in allocation, this value is set to the value of nIter, but we should use 1 here
-	status &= pmTrend2DFit (goodFit, trend, srcMask, 0xff, x, y, e2, NULL);
-	if (!goodFit) {
+	status &= pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, e2, NULL);
+	if (!*pGoodFit) {
 	    psFree (e0);
 	    psFree (e1);
Index: /tags/ipp-20101206/psModules/src/objects/pmTrend2D.c
===================================================================
--- /tags/ipp-20101206/psModules/src/objects/pmTrend2D.c	(revision 30045)
+++ /tags/ipp-20101206/psModules/src/objects/pmTrend2D.c	(revision 30046)
@@ -179,5 +179,5 @@
 }
 
-bool pmTrend2DFit(bool *goodFit, pmTrend2D *trend, psVector *mask, psVectorMaskType maskVal, const psVector *x,
+bool pmTrend2DFit(bool *pGoodFit, pmTrend2D *trend, psVector *mask, psVectorMaskType maskVal, const psVector *x,
                   const psVector *y, const psVector *f, const psVector *df)
 {
@@ -189,10 +189,10 @@
 
     bool status = false;
-    *goodFit = false;
+    *pGoodFit = false;
     // for the psImageMap fit, it is possible to have valid data but no valid solution for
     // example, an isolated cell may not be reached from other cells, making the solution
     // degenerate.  psImageMapFit should probably handle this case, but until it does, we allow
-    // it to fail on the result, but not yield an error (goodFit = false).
-    // psVectorClipFitPolynomial2D can not fail in this way (really?), so goodFit is always
+    // it to fail on the result, but not yield an error (pGoodFit = false).
+    // psVectorClipFitPolynomial2D can not fail in this way (really?), so pGoodFit is always
     // true
 
@@ -204,5 +204,5 @@
         // of points in the image, and potentially based on the fractional range of the
         // data?
-	*goodFit = true;
+	*pGoodFit = true;
         break;
 
@@ -210,5 +210,5 @@
         // XXX supply fraction from trend elements
         // XXX need to add the API which adjusts the scale
-        status = psImageMapClipFit(goodFit, trend->map, trend->stats, mask, maskVal, x, y, f, df);
+        status = psImageMapClipFit(pGoodFit, trend->map, trend->stats, mask, maskVal, x, y, f, df);
         break;
 
