diff --git a/modules/util/abi_surfrad.py b/modules/util/abi_surfrad.py
index 03bd115d03581ca3265ec79cd258d879e05ceffb..7eeeb922684356f6d678c345ef82df1d9050a3c1 100644
--- a/modules/util/abi_surfrad.py
+++ b/modules/util/abi_surfrad.py
@@ -186,7 +186,7 @@ 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]:
+                    if valid_m.shape[0] != valid_i.shape[0]:
                         print('problem: number of samples dont match', valid_m.shape, valid_i.shape)
                         continue
                     if DO_WRITE_OUTFILE:
@@ -211,7 +211,7 @@ 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]:
+        if valid_m.shape[0] != valid_i.shape[0]:
             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)