Index: /trunk/psphot/src/psphotSourceStats.c
===================================================================
--- /trunk/psphot/src/psphotSourceStats.c	(revision 29603)
+++ /trunk/psphot/src/psphotSourceStats.c	(revision 29604)
@@ -140,5 +140,5 @@
 
     if (setWindow) {
-        if (!psphotSetMomentsWindow(recipe, readout->analysis, sources)) {
+        if (!psphotSetMomentsWindow(recipe, readout->analysis, sources, maskVal)) {
             psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!");
             psFree(detections->newSources);
@@ -288,5 +288,5 @@
 
     // XXX how else could we get the window size in?
-    if (!psphotSetMomentsWindow(recipe, readout->analysis, sources)) {
+    if (!psphotSetMomentsWindow(recipe, readout->analysis, sources, 0)) {
         psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!");
         return NULL;
@@ -469,5 +469,5 @@
 // this function attempts to iteratively determine the best value for sigma of the moments weighting Gaussian
 // this function modifies the recipe values MOMENTS_SX_MAX, MOMENTS_SY_MAX, and PSF_CLUMP_GRID_SCALE, used by pmSourcePSFClump
-bool psphotSetMomentsWindow (psMetadata *recipe, psMetadata *analysis, psArray *sources) {
+bool psphotSetMomentsWindow (psMetadata *recipe, psMetadata *analysis, psArray *sources, psImageMaskType maskVal) {
 
     bool status;
@@ -501,5 +501,5 @@
 
             // measure basic source moments (no S/N clipping on input pixels)
-            status = pmSourceMoments (source, 4*sigma[i], sigma[i], 0.0, 0xffff);
+            status = pmSourceMoments (source, 4*sigma[i], sigma[i], 0.0, maskVal);
         }
 
