Index: /trunk/psphot/src/psphotFindFootprints.c
===================================================================
--- /trunk/psphot/src/psphotFindFootprints.c	(revision 20828)
+++ /trunk/psphot/src/psphotFindFootprints.c	(revision 20829)
@@ -12,7 +12,7 @@
     float FOOTPRINT_NSIGMA_LIMIT;
     if (pass == 1) {
-	FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT");
+        FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT");
     } else {
-	FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT_2");
+        FOOTPRINT_NSIGMA_LIMIT = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NSIGMA_LIMIT_2");
     }
     PS_ASSERT (status, false);
@@ -25,11 +25,11 @@
     int growRadius = 0;
     if (pass == 1) {
-	growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS");
+        growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS");
     } else {
-	growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS_2");
+        growRadius = psMetadataLookupS32(&status, recipe, "FOOTPRINT_GROW_RADIUS_2");
     }
     PS_ASSERT (status, false);
 
-    // find the raw footprints & assign the peaks to those footprints 
+    // find the raw footprints & assign the peaks to those footprints
     psArray *footprints = pmFootprintsFind (significance, threshold, npixMin);
 
@@ -38,5 +38,5 @@
 
     // footprints now owns the peaks; after culling (below), we will rebuild the peaks array
-    psFree (detections->peaks); 
+    psFree (detections->peaks);
 
     psLogMsg ("psphot", PS_LOG_MINUTIA, "found %ld footprints: %f sec\n", footprints->n, psTimerMark ("psphot.footprints"));
@@ -44,24 +44,26 @@
     // optionally grow footprints isotropically by growRadius pixels
     if (growRadius > 0) {
-	psArray *tmp = pmFootprintArrayGrow(footprints, growRadius);
-	psLogMsg ("psphot", PS_LOG_MINUTIA, "grow footprint coverage by %d pixels, %ld footprints become %ld footprints: %f sec\n", growRadius, footprints->n, tmp->n, psTimerMark ("psphot.footprints"));
-	psFree(footprints);
-	footprints = tmp;
+        bool oldThreads = psImageConvolveThreads(true); // Old value of threading for psImageConvolve
+        psArray *tmp = pmFootprintArrayGrow(footprints, growRadius);
+        psImageConvolveThreads(oldThreads);
+        psLogMsg ("psphot", PS_LOG_MINUTIA, "grow footprint coverage by %d pixels, %ld footprints become %ld footprints: %f sec\n", growRadius, footprints->n, tmp->n, psTimerMark ("psphot.footprints"));
+        psFree(footprints);
+        footprints = tmp;
     }
 
     if (pass == 2) {
-	// merge in old peaks;
-	const int includePeaks = 0x0 | 0x2; // i.e. just from newFootprints
-	
-	// XXX EAM : still not sure I understand this: are we double-couning or undercounting peaks
+        // merge in old peaks;
+        const int includePeaks = 0x0 | 0x2; // i.e. just from newFootprints
 
-	psArray *mergedFootprints = pmFootprintArraysMerge(detections->footprints, footprints, includePeaks);
-	psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, detections->footprints->n, psTimerMark ("psphot.footprints"));
+        // XXX EAM : still not sure I understand this: are we double-couning or undercounting peaks
 
-	psFree(footprints);
-	psFree(detections->footprints);
-	detections->footprints = mergedFootprints;
+        psArray *mergedFootprints = pmFootprintArraysMerge(detections->footprints, footprints, includePeaks);
+        psLogMsg ("psphot", PS_LOG_MINUTIA, "merged %ld new footprints with %ld existing ones: %f sec\n", footprints->n, detections->footprints->n, psTimerMark ("psphot.footprints"));
+
+        psFree(footprints);
+        psFree(detections->footprints);
+        detections->footprints = mergedFootprints;
     } else {
-	detections->footprints = footprints;
+        detections->footprints = footprints;
     }
 
Index: /trunk/psphot/src/psphotReadout.c
===================================================================
--- /trunk/psphot/src/psphotReadout.c	(revision 20828)
+++ /trunk/psphot/src/psphotReadout.c	(revision 20829)
@@ -7,5 +7,4 @@
     psphotModelClassInit ();            // load implementation-specific models
     psphotSetThreads ();
-    psImageConvolveSetThreads(true);
     return true;
 }
Index: /trunk/psphot/src/psphotSignificanceImage.c
===================================================================
--- /trunk/psphot/src/psphotSignificanceImage.c	(revision 20828)
+++ /trunk/psphot/src/psphotSignificanceImage.c	(revision 20829)
@@ -12,5 +12,5 @@
     // smooth the image and weight map
     psTimerStart ("psphot.smooth");
-    psImageConvolveSetThreads(true);
+    bool oldThreads = psImageConvolveSetThreads(true); // Old value of threading in psImageConvolve
 
     // XXX we can a) choose fft to convolve if needed and b) multithread fftw
@@ -128,9 +128,12 @@
 
     psFree(smooth_wt);
+
+    psImageConvolveSetThreads(oldThreads);
+
     return smooth_im;
 }
 
-# if (0) 
-{ 
+# if (0)
+{
     // threadingdemo
     // smooth the image, applying the mask as we go
Index: /trunk/psphot/src/psphotSourceSize.c
===================================================================
--- /trunk/psphot/src/psphotSourceSize.c	(revision 20828)
+++ /trunk/psphot/src/psphotSourceSize.c	(revision 20829)
@@ -218,5 +218,7 @@
     // now that we have masked pixels associated with CRs, we can grow the mask
     if (grow > 0) {
+        bool oldThreads = psImageConvolveThreads(true); // Old value of threading for psImageConvolveMask
         psImage *newMask = psImageConvolveMask(NULL, readout->mask, crMask, crMask, -grow, grow, -grow, grow);
+        psImageConvolveThreads(oldThreads);
         if (!newMask) {
             psError(PS_ERR_UNKNOWN, false, "Unable to grow CR mask");
