diff --git a/edosl0util/merge.py b/edosl0util/merge.py
index 384fe4c8e332c87b53ac61bc4463987a73eae883..bb987b036c672b6873e1ed7220ee63f5443ef04f 100644
--- a/edosl0util/merge.py
+++ b/edosl0util/merge.py
@@ -38,7 +38,8 @@ def merge(streams, output=sys.stdout):
 
     # streams are removed as they are exhausted
     while streams:
-        for stream in streams:
+        if 1:
+            stream = streams.pop(0)
             try:
                 if last_packet is not None:
                     LOG.debug("seeking to %s, %s", last_packet.stamp, last_packet.apid)
@@ -74,23 +75,21 @@ def merge(streams, output=sys.stdout):
 
                     while packets:
                         pkt = packets.popleft()
-                        LOG.debug('writing %s: %s', stream, pkt)
                         output.write(pkt.bytes())
 
             except PacketTooShort as err:
                 LOG.error("corrupt stream, removing: %s", err)
-                streams.remove(stream)
 
             except NonConsecutiveSeqId:
+                steams.push(stream)
                 LOG.debug('missing sequence id, next stream')
 
             except StopIteration:
-                streams.remove(stream)
                 LOG.debug("end-of-stream %s", stream)
-                continue
 
 
 def merge_files(filepaths, destpath):
     filepaths, streams = make_streams(filepaths, fail_on_missing=True)
-    LOG.debug("merge order %s", filepaths)
+    for i in range(0, len(filepaths)):
+        LOG.debug("stream %s filepath %s", streams[i], filepaths[i])
     merge(streams, output=io.open(destpath, 'wb'))