Index: /branches/eam_branches/ipp-20101205/psModules/src/imcombine/pmSubtractionMatch.c
===================================================================
--- /branches/eam_branches/ipp-20101205/psModules/src/imcombine/pmSubtractionMatch.c	(revision 30331)
+++ /branches/eam_branches/ipp-20101205/psModules/src/imcombine/pmSubtractionMatch.c	(revision 30332)
@@ -675,11 +675,8 @@
 		// generate the window function from the set of stamps
 		if (!pmSubtractionStampsGetWindow(&tryAgain, stamps, size)) {
-		    // if we failed, it might be due to the desired normWindow being larger than the current size.
-		    // in this case, just adjust the size and try again.
+		    // if we failed, it might be due to the desired normWindow being larger than the current footprint.
+		    // in this case, just adjust the footprint and try again.
 		    if (tryAgain) {
-			// keep the same footprint-size buffer:
-			int boundary = footprint - size;
-			size = PS_MAX(stamps->normWindow1, stamps->normWindow2) + 2;
-			footprint = size + boundary;
+			footprint = PS_MAX(stamps->normWindow1, stamps->normWindow2) + 2;
 
 			// we need to reconstruct everything, so just free the stamps here and retry
@@ -731,15 +728,28 @@
 		psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k);
 
-		if (!pmSubtractionStampsSelect(&stamps, ro1, ro2, subMask, variance, region,
-					       stampThresh1, stampThresh2, stampSpacing, normFrac,
-					       sysError, skyError, size, footprint, subMode)) {
-		    goto MATCH_ERROR;
-		}
-
-		// Generate the window function from the set of stamps.  Since we succeeded
-		// above to define a normWindow, if we fail here, it is probably unrecoverable.
-		if (!pmSubtractionStampsGetWindow(NULL, stamps, size)) {
-		    psError(psErrorCodeLast(), false, "Unable to get stamps window.");
-		    goto MATCH_ERROR;
+		bool tryAgain = true;
+		while (tryAgain) {
+		    // We get the stamps here; we will also attempt to get stamps at the first iteration, but it
+		    // doesn't matter.
+		    if (!pmSubtractionStampsSelect(&stamps, ro1, ro2, subMask, variance, region, stampThresh1, stampThresh2,
+						   stampSpacing, normFrac, sysError, skyError, size, footprint, subMode)) {
+			goto MATCH_ERROR;
+		    }
+
+		    // generate the window function from the set of stamps
+		    if (!pmSubtractionStampsGetWindow(&tryAgain, stamps, size)) {
+			// if we failed, it might be due to the desired normWindow being larger than the current footprint.
+			// in this case, just adjust the footprint and try again.
+			if (tryAgain) {
+			    footprint = PS_MAX(stamps->normWindow1, stamps->normWindow2) + 2;
+
+			    // we need to reconstruct everything, so just free the stamps here and retry
+			    psFree(stamps);
+			} else {
+			    // unrecoverable error
+			    psError(psErrorCodeLast(), false, "Unable to get stamp window.");
+			    goto MATCH_ERROR;
+			}
+		    }
 		}
 
