diff --git a/edosl0util/merge.py b/edosl0util/merge.py
index c55dd67e7efa931b0ed84c8640e0803ae3ab40ec..20eebcec3525d2df271ca0e6f0d08d8ecfa92f35 100644
--- a/edosl0util/merge.py
+++ b/edosl0util/merge.py
@@ -64,6 +64,11 @@ def read_packet_index(stream):
             LOG.info('dropped %d leading packets', count)
 
         while True:
+            if not packet.stamp:
+                # corrupt packet groups can cause apid mismatch
+                # so skip until we get to the next group
+                packet = stream.next()
+                continue
             ptr = _Ptr(
                 stream.file,
                 stamp=packet.stamp,
@@ -75,6 +80,10 @@ def read_packet_index(stream):
             # collect all packets for this stamp/group
             packet = stream.next()
             while not packet.stamp:
+                # Bail if we're collecting group packets and apids don't match
+                # This means group is corrupt
+                if ptr.apid != packet.apid:
+                    break
                 ptr.size += packet.size
                 ptr.count += 1
                 packet = stream.next()