Index: /trunk/Mars/mcore/factfits.h
===================================================================
--- /trunk/Mars/mcore/factfits.h	(revision 16938)
+++ /trunk/Mars/mcore/factfits.h	(revision 16939)
@@ -62,6 +62,8 @@
          {
              if (*startCell < 0)
+             {
+                 data += fNumRoi;
                  continue;
-
+             }
              for (uint32_t j=0; j<fNumRoi; j++, data++)
                  *data += fOffsetCalibration[i + (*startCell+j)%1024];
@@ -79,10 +81,11 @@
              }
 
+             const int16_t modStart = startCell[ch] % 1024;
              const int16_t *off = fOffsetCalibration.data() + ch*1024;
 
-             const int16_t *cal = off+startCell[ch];
+             const int16_t *cal = off+modStart;
              const int16_t *end = data+fNumRoi;
 
-             if (startCell[ch]+fNumRoi>1024)
+             if (modStart+fNumRoi>1024)
              {
                  while (cal<off+1024)
@@ -94,5 +97,6 @@
                  *data++ += *cal++;
          }
-    }
+
+}
 
     bool init()
