diff --git a/src/calng/corrections/Gotthard2Correction.py b/src/calng/corrections/Gotthard2Correction.py
index f8fa85bb6aa2684a9f33194bf7bdcbc77fd034ca..386aafc7d8d5d1a990c04f04afa5412d97e1cb44 100644
--- a/src/calng/corrections/Gotthard2Correction.py
+++ b/src/calng/corrections/Gotthard2Correction.py
@@ -346,7 +346,7 @@ class Gotthard2Correction(base_correction.BaseCorrection):
         gain_data = np.asarray(
             data_hash.get("data.gain")
         ).astype(np.uint8, copy=False)
-        num_frames = image_data.shape[0]
+        num_frames = len(data_hash.get("data.frameNumber"))
         if self.unsafe_get("workarounds.overrideInputAxisOrder"):
             expected_shape = self.kernel_runner.expected_input_shape(num_frames)
             image_data.shape = expected_shape