diff --git a/src/cal_tools/agipdlib.py b/src/cal_tools/agipdlib.py
index c436a2b78672484b250e8d8f351ee245c8ce6dde..74c3b852b1883763858cb3df0a8252f66a173455 100644
--- a/src/cal_tools/agipdlib.py
+++ b/src/cal_tools/agipdlib.py
@@ -347,9 +347,9 @@ class AgipdCtrlRuns:
         sort_values = []
         if self.gain_modes == self.adaptive_gain_modes:  # Adaptive gain # sort by patterns
             # Patterns -> DarkHG: 1, DarkMG: 2, DarkLG: 3
-            if "patternTypeIndex.value" in self.run_ctrls[0].run_dc.keys_for_source(self.ctrl_src):
+            if "patternTypeIndex" in self.run_ctrls[0].run_dc[self.ctrl_src]:
                 sort_by = "patternTypeIndex"
-            elif "expTypeIndex.value" in self.run_ctrls[0].run_dc.keys_for_source(self.ctrl_src):
+            elif "expTypeIndex" in self.run_ctrls[0].run_dc[self.ctrl_src]:
                 sort_by = "expTypeIndex"
             else:
                 raise ValueError(