Index: /branches/eam_branches/ipp-20100621/psphot/src/psphotApResid.c
===================================================================
--- /branches/eam_branches/ipp-20100621/psphot/src/psphotApResid.c	(revision 28796)
+++ /branches/eam_branches/ipp-20100621/psphot/src/psphotApResid.c	(revision 28797)
@@ -328,5 +328,5 @@
     psMetadataAdd (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_DATA_F32 | PS_META_REPLACE, "ap residual scatter", psf->dApResid);
     psMetadataAdd (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_DATA_S32 | PS_META_REPLACE, "number of apresid stars", psf->nApResid);
-    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS",   PS_DATA_F32 | PS_META_REPLACE, "aperture loss (mag)", psf->growth->apLoss);
+    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS",   PS_DATA_F32 | PS_META_REPLACE, "aperture loss (mag)", psf->growth ? psf->growth->apLoss : NAN);
 
     psLogMsg ("psphot.apresid", PS_LOG_DETAIL, "aperture residual: %f +/- %f\n", psf->ApResid, psf->dApResid);
Index: /branches/eam_branches/ipp-20100621/psphot/src/psphotSignificanceImage.c
===================================================================
--- /branches/eam_branches/ipp-20100621/psphot/src/psphotSignificanceImage.c	(revision 28796)
+++ /branches/eam_branches/ipp-20100621/psphot/src/psphotSignificanceImage.c	(revision 28797)
@@ -76,5 +76,11 @@
     // Calculate correction factor for the covariance produced by the (potentially multiple) smoothing
     psKernel *kernel = psImageSmoothKernel(SIGMA_SMTH, NSIGMA_SMTH); // Kernel used for smoothing
-    float factor = 1.0 / psImageCovarianceCalculateFactor(kernel, readout->covariance);
+    double sum2 = 0.0;                                               // Sum of kernel squared
+    for (int y = kernel->yMin; y <= kernel->yMax; y++) {
+        for (int x = kernel->xMin; x <= kernel->xMax; x++) {
+            sum2 += PS_SQR(kernel->kernel[y][x]);
+        }
+    }
+    float factor = 1.0 / (sum2 * psImageCovarianceCalculateFactor(kernel, readout->covariance));
     psFree(kernel);
 
