Index: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3352)
+++ trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc	(revision 3353)
@@ -352,14 +352,9 @@
   Float_t avouterprms = 0;
   Float_t avouternum  = 0;
+
   for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++)
     {
 
       MCalibrationChargePix &pix = (*fCam)[pixid];
-
-      //
-      // Check if the pixel has been excluded from the fits
-      //
-      if (pix.IsExcluded())
-        continue;
 
       //
@@ -370,9 +365,18 @@
       const Float_t num    = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries());
 
+      if (ped == -1.) 
+	  pix.SetExcluded();
+      
+      //
+      // Check if the pixel has been excluded from the fits
+      //
+      if (pix.IsExcluded())
+        continue;
+
       if (fGeom->GetPixRatio(pixid) == 1.)
       {
 	  avinnerped  += ped;
 	  avinnerprms += prms;
-	  avinnernum  += num;
+	  avinnernum++;
       }
       else
@@ -380,5 +384,5 @@
 	  avouterped  += ped;
 	  avouterprms += prms;
-	  avouternum  += num;
+	  avouternum++;
       }
       //
