diff --git a/modules/util/abi_surfrad.py b/modules/util/abi_surfrad.py
index dfc1896a8ee6235da5a7b601c1f1c8914b9f04fe..03bd115d03581ca3265ec79cd258d879e05ceffb 100644
--- a/modules/util/abi_surfrad.py
+++ b/modules/util/abi_surfrad.py
@@ -186,6 +186,9 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
                 if len(data_tiles_m) > 0:
                     valid_i = np.stack(data_tiles_i)
                     valid_m = np.stack(data_tiles_m)
+                    if valid_m.shape[0] != valid_i.shape[1]:
+                        print('problem: number of samples dont match', valid_m.shape, valid_i.shape)
+                        continue
                     if DO_WRITE_OUTFILE:
                         np.save(out_directory + 'valid_mres_' + f'{cnt:04d}', valid_m)
                         np.save(out_directory + 'valid_ires_' + f'{cnt:04d}', valid_i)
@@ -208,7 +211,9 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
     if len(data_tiles_m) > 0:
         valid_i = np.stack(data_tiles_i)
         valid_m = np.stack(data_tiles_m)
-        if DO_WRITE_OUTFILE:
+        if valid_m.shape[0] != valid_i.shape[1]:
+            print('problem: number of samples dont match', valid_m.shape, valid_i.shape)
+        elif DO_WRITE_OUTFILE:
             np.save(out_directory + 'valid_mres_' + f'{cnt:04d}', valid_m)
             np.save(out_directory + 'valid_ires_' + f'{cnt:04d}', valid_i)
         num_valid_samples = valid_m.shape[0]