Index: trunk/ppStack/src/ppStackLoop.c
===================================================================
--- trunk/ppStack/src/ppStackLoop.c	(revision 23171)
+++ trunk/ppStack/src/ppStackLoop.c	(revision 23190)
@@ -257,4 +257,6 @@
     pmPSF *targetPSF = NULL;            // Target PSF
     float sumExposure = NAN;            // Sum of exposure times
+    psVector *inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs
+    psVectorInit(inputMask, 0);
     if (psMetadataLookupBool(NULL, config->arguments, "HAVE.PSF")) {
         pmFPAfileActivate(config->files, false, NULL);
@@ -283,4 +285,5 @@
                 psFree(fileIter);
                 psFree(psfs);
+                psFree(inputMask);
                 return false;
             }
@@ -299,4 +302,5 @@
                 psFree(fileIter);
                 psFree(psfs);
+                psFree(inputMask);
                 return false;
             }
@@ -324,5 +328,6 @@
                     psFree(sourceLists);
                     psFree(targetPSF);
-                    return false;
+                    psFree(inputMask);
+                   return false;
                 }
 
@@ -333,4 +338,5 @@
                     psFree(sourceLists);
                     psFree(targetPSF);
+                    psFree(inputMask);
                     return false;
                 }
@@ -340,4 +346,5 @@
                     psFree(sourceLists);
                     psFree(targetPSF);
+                    psFree(inputMask);
                     return false;
                 }
@@ -351,9 +358,10 @@
 
         // Zero point calibration
-        sumExposure = ppStackSourcesTransparency(sourceLists, view, config);
+        sumExposure = ppStackSourcesTransparency(sourceLists, inputMask, view, config);
         if (!isfinite(sumExposure) || sumExposure <= 0) {
             psError(PS_ERR_UNKNOWN, false, "Unable to calculate transparency differences");
             psFree(sourceLists);
             psFree(targetPSF);
+            psFree(inputMask);
             return false;
         }
@@ -366,4 +374,5 @@
             psFree(sourceLists);
             psFree(view);
+            psFree(inputMask);
             return false;
         }
@@ -409,6 +418,4 @@
     int numGood = 0;                    // Number of good frames
     int numCols = 0, numRows = 0;       // Size of image
-    psVector *inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs
-    psVectorInit(inputMask, 0);
     psVector *matchChi2 = psVectorAlloc(num, PS_TYPE_F32); // chi^2 for stamps when matching
     psVectorInit(matchChi2, NAN);
@@ -419,4 +426,7 @@
     psArray *covariances = psArrayAlloc(num); // Covariance matrices
     for (int i = 0; i < num; i++) {
+        if (inputMask->data.U8[i]) {
+            continue;
+        }
         psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num);
         pmFPAfileActivate(config->files, false, NULL);
