diff --git a/SpectrumAWG/blacs_workers.py b/SpectrumAWG/blacs_workers.py
index b2b3730df302b8e11920a3d8b3c3e3a72071828c..16bc26f59501494aa130781a1e54e0a6daf59a45 100644
--- a/SpectrumAWG/blacs_workers.py
+++ b/SpectrumAWG/blacs_workers.py
@@ -2,6 +2,7 @@ import labscript_utils.h5_lock
 import h5py
 from blacs.tab_base_classes import Worker
 from . import SpectrumCard
+import numpy as np
 
 class SpectrumAWGWorker(Worker):
     def init(self):
@@ -68,7 +69,8 @@ class SpectrumAWGWorker(Worker):
                     self.smart_cache = {}
 
                 last_index = len(group[ch].attrs)-1
-                for index,t in enumerate(group[ch].attrs):
+                times = np.sort(np.array(group[ch].attrs).astype(np.float32)) # The attribute names are strings and sorted wrong. TODO: better perfomance without sorting here?
+                for index,t in enumerate(times):
                     ### LOOP TROUGH STREAMING STEPS ###
                     instruction = group[ch].attrs[t]
                     instruction_hash = hash(instruction.tobytes())