Index: trunk/psModules/src/imcombine/pmStack.c
===================================================================
--- trunk/psModules/src/imcombine/pmStack.c	(revision 23577)
+++ trunk/psModules/src/imcombine/pmStack.c	(revision 23773)
@@ -33,7 +33,7 @@
 #define NUM_DIRECT_STDEV 5              // For less than this number of values, measure stdev directly
 
-//#define TESTING                         // Enable test output
-//#define TEST_X 2318                     // x coordinate to examine
-//#define TEST_Y 2306                     // y coordinate to examine
+#define TESTING                         // Enable test output
+#define TEST_X 1085                     // x coordinate to examine
+#define TEST_Y 3371                     // y coordinate to examine
 
 
@@ -265,5 +265,5 @@
 
     int numBad = frac * numGood + 0.5;  // Number of bad values
-    int low = numBad / 2, high = low + numGood; // Indices (modulo masked pixels) delimiting range of interest
+    int low = numBad / 2, high = low + numGood - numBad; // Indices (modulo masked pixels)
 
     sortBuffer = psVectorSortIndex(sortBuffer, values);
@@ -536,8 +536,13 @@
 #ifdef TESTING
                   if (x == TEST_X && y == TEST_Y) {
-                      fprintf(stderr, "Rejection limit: %f\n", limit);
+                      fprintf(stderr, "Rejecting without variance; rejection limit: %f\n", limit);
                   }
 #endif
               } else {
+#ifdef TESTING
+                  if (x == TEST_X && y == TEST_Y) {
+                      fprintf(stderr, "Rejecting with variance...\n");
+                  }
+#endif
                   median = combinationWeightedOlympic(pixelData, pixelWeights, pixelMasks, discard, sort);
               }
