diff --git a/cal_tools/cal_tools/agipdlib.py b/cal_tools/cal_tools/agipdlib.py
index 4530e5d77cdc83881b4f1228a1df5f4120f18756..fb51034ffa38e75737d1fba50a0be12e9aea6101 100644
--- a/cal_tools/cal_tools/agipdlib.py
+++ b/cal_tools/cal_tools/agipdlib.py
@@ -625,7 +625,6 @@ class AgipdCorrections:
             first = np.squeeze(infile[idx_base + "image/first"])
             nonzero_count = np.count_nonzero(count != 0)
             zero_count = count.shape[0] - nonzero_count
-            zero_indices = np.where(count == 0)[0]
             if nonzero_count == 0:
                 raise IOError("File has no valid counts")
             valid = count != 0