diff --git a/src/cal_tools/agipdlib.py b/src/cal_tools/agipdlib.py
index 3a9da4e2283e9d784def6537b8bda7e8e0163023..e52e1a007abac353a54d73de85b8c2e52e651ea5 100644
--- a/src/cal_tools/agipdlib.py
+++ b/src/cal_tools/agipdlib.py
@@ -315,8 +315,7 @@ class CellSelection:
         raise NotImplementedError
 
     def get_cells_on_trains(
-        self, train_sel: np.ndarray, nfrm: np.ndarray,
-        cellid: np.ndarray, cm: int = 0
+        self, train_sel: np.ndarray, nfrm: np.ndarray, cm: int = 0
     ) -> np.array:
         """Returns mask of cells selected for processing
 
@@ -327,8 +326,6 @@ class CellSelection:
             for common-mode correction
 
         :return: boolean array with flags indicating images for processing
-        :return: integer array with number of frames to use in the second
-            step in two step selection procedure
         """
         raise NotImplementedError
 
@@ -537,7 +534,7 @@ class AgipdCorrections:
         n_valid_trains = len(valid_train_ids)
         data_dict["n_valid_trains"][0] = n_valid_trains
         data_dict["valid_trains"][:n_valid_trains] = valid_train_ids
-        #data_dict["nimg_in_trains"][:n_valid_trains] = nimg_in_trains
+        data_dict["nimg_in_trains"][:n_valid_trains] = nimg_in_trains
 
         if "AGIPD500K" in agipd_base:
             agipd_comp = components.AGIPD500K(im_dc)
@@ -552,11 +549,8 @@ class AgipdCorrections:
         cm = (self.cell_sel.CM_NONE if apply_sel_pulses
               else self.cell_sel.CM_PRESEL)
 
-        cellid = np.squeeze(im_dc[agipd_base, "image.cellId"].ndarray())
-
-        img_selected, nimg_in_trains = self.cell_sel.get_cells_on_trains(
-            np.array(valid_train_ids), nimg_in_trains, cellid, cm=cm)
-        data_dict["nimg_in_trains"][:n_valid_trains] = nimg_in_trains
+        img_selected = self.cell_sel.get_cells_on_trains(
+            np.array(valid_train_ids), nimg_in_trains, cm=cm)
 
         frm_ix = np.flatnonzero(img_selected)
         data_dict["cm_presel"][0] = (cm == self.cell_sel.CM_PRESEL)
@@ -1027,11 +1021,10 @@ class AgipdCorrections:
         ntrains = data_dict["n_valid_trains"][0]
         train_ids = data_dict["valid_trains"][:ntrains]
         nimg_in_trains = data_dict["nimg_in_trains"][:ntrains]
-        cellid = data_dict["cellId"][:n_img]
 
         # Initializing can_calibrate array
-        can_calibrate, _ = self.cell_sel.get_cells_on_trains(
-            train_ids, nimg_in_trains, cellid, cm=self.cell_sel.CM_FINSEL
+        can_calibrate = self.cell_sel.get_cells_on_trains(
+            train_ids, nimg_in_trains, cm=self.cell_sel.CM_FINSEL
         )
         if np.all(can_calibrate):
             return n_img
@@ -1630,7 +1623,6 @@ class CellRange(CellSelection):
         self.flag_cm[:self.max_cells] = self.flag
         self.flag_cm = (self.flag_cm.reshape(-1, self.row_size).any(1)
                         .repeat(self.row_size)[:self.max_cells])
-        self.sel_type = [self.flag, self.flag_cm, self.flag]
 
     def msg(self):
         return (
@@ -1640,24 +1632,10 @@ class CellRange(CellSelection):
         )
 
     def get_cells_on_trains(
-        self, train_sel: np.ndarray, nfrm: np.ndarray,
-        cellid: np.ndarray, cm: int = 0
+        self, train_sel: np.ndarray, nfrm: np.ndarray, cm: int = 0
     ) -> np.array:
-        if cm < 0 or cm > 2:
-            raise ValueError("param 'cm' takes only 0,1,2")
-
-        flag = self.sel_type[cm]
-        sel = np.zeros(np.sum(nfrm), bool)
-        counts = np.zeros(len(nfrm), int)
-        i0 = 0
-        for i, nfrm_i in enumerate(nfrm):
-            iN = i0 + nfrm_i
-            f = flag[cellid[i0:iN]]
-            sel[i0:iN] = f
-            counts[i] = np.sum(f)
-            i0 = iN
-
-        return sel, counts
+        return np.tile(self._sel_for_cm(self.flag, self.flag_cm, cm),
+                       len(train_sel))
 
     def filter_trains(self, train_sel: np.ndarray):
         return train_sel
@@ -1734,14 +1712,12 @@ class LitFrameSelection(CellSelection):
         )
 
     def get_cells_on_trains(
-        self, train_sel: np.ndarray, nfrm: np.ndarray,
-        cellid: np.ndarray, cm: int = 0
+        self, train_sel: np.ndarray, nfrm: np.ndarray, cm: int = 0
     ) -> np.array:
 
         cell_flags, cm_flags = self._sel.litframes_on_trains(
             train_sel, nfrm, [self.final_sel_type, self.cm_sel_type])
-        sel = self._sel_for_cm(cell_flags, cm_flags, cm)
-        return sel, nfrm
+        return self._sel_for_cm(cell_flags, cm_flags, cm)
 
     def filter_trains(self, train_sel: np.ndarray):
         return self._sel.filter_trains(train_sel, drop_empty=True)