diff --git a/ADwinProII/blacs_workers.py b/ADwinProII/blacs_workers.py
index f5956cd4cb05a69dec1d69623708ae502a32e2f0..ef8ce38bd18e221ed625e1eb4a67e5c3cf14d68b 100644
--- a/ADwinProII/blacs_workers.py
+++ b/ADwinProII/blacs_workers.py
@@ -143,8 +143,8 @@ class ADwinProIIWorker(Worker):
             # Send stop time to ADwin
             self.adw.Set_Par(2, int(self.stop_time * CLOCK_T12 / self.PROCESSDELAY))
             # Send wait time and timeout to ADwin (default 0 if no waits)
-            self.adw.Set_Par(3, group.attrs.get("wait_time",-1))
-            self.adw.Set_Par(5, group.attrs.get("wait_timeout",0))
+            self.adw.Set_Par(3, int(group.attrs.get("wait_time",-1)))
+            self.adw.Set_Par(5, int(group.attrs.get("wait_timeout",0)))
             # Send data to ADwin
             AOUT = group["ANALOG_OUT/VALUES"]
             if fresh or not np.array_equal(AOUT[:],self.smart_cache["AOUT"]):
@@ -160,7 +160,7 @@ class ADwinProIIWorker(Worker):
                     self.smart_cache[name] = DOUT[:]
                     self.adw.SetData_Long(DOUT["n_cycles"], module,   1, DOUT.shape[0])
                     self.adw.SetData_Long(DOUT["bitfield"], module+1, 1, DOUT.shape[0])
-                    self.adw.Set_Par(module-1, DOUT.attrs.get("wait_time",-1))
+                    self.adw.Set_Par(module-1, int(DOUT.attrs.get("wait_time",-1)))
             PIDs = group["ANALOG_OUT/PID_CHANNELS"]
             if fresh or not np.array_equal(PIDs[:],self.smart_cache["PIDs"]):
                 print("PIDs programmed.")
diff --git a/ADwinProII/labscript_devices.py b/ADwinProII/labscript_devices.py
index f7697e7fa264cdf94b5886bb499e88994221862f..8fddb6b04337e52a164d89ef98452ca0daf93fc8 100644
--- a/ADwinProII/labscript_devices.py
+++ b/ADwinProII/labscript_devices.py
@@ -324,5 +324,5 @@ class ADwinProII(PseudoclockDevice):
             hdf5_file[f"devices/{self.name}"].attrs["wait_time"] = round(time * self._pseudoclock_T12.clock_limit)
             hdf5_file[f"devices/{self.name}"].attrs["wait_timeout"] = round(args[1] * self._pseudoclock_T12.clock_limit)
             for TiCo in self.TiCos:
-                hdf5_file[f"devices/{self.name}/DIGITAL_OUT/"].attrs["wait_time"] = round(time * self._pseudoclock_T12.clock_limit)
+                hdf5_file[f"devices/{self.name}/DIGITAL_OUT/"].attrs["wait_time"] = round(time * self.TiCos[TiCo].clock_limit)
         
\ No newline at end of file
diff --git a/DCAMCamera/blacs_workers.py b/DCAMCamera/blacs_workers.py
index b5e6026500d5dfe27f5b4c205ff3f5ad1d7b842b..4cfd035ba9e51089e63fd9da8202dc48ff4915dd 100644
--- a/DCAMCamera/blacs_workers.py
+++ b/DCAMCamera/blacs_workers.py
@@ -234,7 +234,7 @@ class DCAM_Camera(object):
             # Send image to occupation receiver
             if tweezer_socket and tweezer_img_no==i:
                 if bright_img_no is not None:
-                    occupation = get_occupation(images[-1]-images[bright_img_no])
+                    occupation = get_occupation(np.array(images[-1],dtype=np.int32)-np.array(images[bright_img_no],dtype=np.int32))
                 else:
                     occupation = get_occupation(images[-1]-200)
                 metadata = dict(dtype=str(occupation.dtype), shape=occupation.shape)
@@ -243,7 +243,7 @@ class DCAM_Camera(object):
                 print(f"Trying to send image {len(images)} to occupation receiver...", end="\r")
                 response = tweezer_socket.recv()
                 assert response == b'ok', response
-                print(f"Sent image {len(images)} to occupation receiver.")
+                print(f"Sent occupation for image {len(images)} to occupation receiver.")
             print(f"Got image {i+1} of {n_images}.")                    
 
         print(f"Got {len(images)} of {n_images} images.")
diff --git a/SpectrumAWG/blacs_workers.py b/SpectrumAWG/blacs_workers.py
index e4ff744f91b3358ec103ddfe7e902bb9ae5d7ef3..aba623a864a56712a3926a26f6639f66d0e3886a 100644
--- a/SpectrumAWG/blacs_workers.py
+++ b/SpectrumAWG/blacs_workers.py
@@ -109,12 +109,13 @@ class SpectrumAWGWorker(Worker):
                         if index_h5 in group[ch]["labels"].attrs:
                             initial_values[memory_index] = group[ch]["labels"].attrs[index_h5]
                         self.AWG.transfer_sequence_replay_samples(memory_index,data)
-                    if index!=last_index:
+                    if index!=last_index or function_conditional_programming:
                         self.AWG.seq_set_sequence_step(index,memory_index,index+1,1,'on_trigger',last_step=False)
                     else:
                         self.AWG.seq_set_sequence_step(index,memory_index,index,1,'on_trigger',last_step=False)
                         # If there is a trigger at the stop time, repeat one last sequence 
-                        # and then stop (is not card_stop() was called already)
+                        # and then stop (if not card_stop() was called already)
+                    if index==last_index:
                         self.AWG.seq_set_sequence_step(index+1,memory_index,0,1,'always',last_step=True)
                 # ONLY IMPLEMENTED FOR ONE CHANNEL, IF TWO CHANNELS ARE NEEDED WE ALREADY GET AN ERROR IN LABSCRIPT
                 # FOR IMPLEMENTATION ONE HASE TO INTERWEAVE THE DATA FOR BOTH CHANNELS