diff --git a/sohstationviewer/model/handling_data.py b/sohstationviewer/model/handling_data.py
index d83766871d9d43ecd8558abab2b221c5f04ef95d..2092766e41d14eff28951701707c66b373ad6fb8 100644
--- a/sohstationviewer/model/handling_data.py
+++ b/sohstationviewer/model/handling_data.py
@@ -434,8 +434,9 @@ def combine_traces_except_gaps_overlaps(
     curr_gap_idx = 0
     for idx, tr in enumerate(traces):
         try:
-            if (min(gaps[curr_gap_idx]) <= tr['startTmEpoch']
-                    <= max(gaps[curr_gap_idx]) and size != 0):
+            start_in_gap = (min(gaps[curr_gap_idx]) <= tr['startTmEpoch']
+                            <= max(gaps[curr_gap_idx]))
+            if start_in_gap and size != 0:
                 new_tr = {'samplerate': tr['samplerate'],
                           'startTmEpoch': start_epoch,
                           'endTmEpoch': end_epoch,