diff --git a/interpret_qc.py b/interpret_qc.py
index 862f186641dc5612c5811292d932ce6d820cb78b..322e6e20bddd08aff459d43afee7a0e255eb1287 100644
--- a/interpret_qc.py
+++ b/interpret_qc.py
@@ -51,6 +51,7 @@ def ignore_error(func, error):
 def plot_check(nc, check, sum_hk):
     check_var = nc.variables[check]
     passes_qc = check_var[:] < .95
+    assert len(passes_qc) == len(sum_hk)
     for depend in check_var.depends.split(','):
         if depend in sum_hk.columns:
             fig = plt.figure()
diff --git a/main.py b/main.py
index 353075dc9511138139b04f59f51772e856d6eed6..039fee736001bff95098c5896c36c7eb2bf45973 100644
--- a/main.py
+++ b/main.py
@@ -102,7 +102,8 @@ def read_frame(cxs_file, sum_file):
     sum_.index.name = 'sum_index'
     
     # Combine extra data from SUM into CXS
-    non_cal_records = non_cal_records.combine_first(sum_)
+    # also non_cal_records may have a different number of records than the sum, so limit by the sum
+    non_cal_records = non_cal_records.combine_first(sum_).ix[sum_.index]
     hk = cxs.combine_first(non_cal_records.reset_index().set_index('cxs_index'))
     hk.calibration_graph = compute_calibration_graph(hk.sceneMirrorPosition)
     return hk