diff --git a/scripts/TargetListToCoords.py b/scripts/TargetListToCoords.py
index 34a37c544991c010a826b6aadfb1ec05b14a4992..115e566a4e83acce5397404364fe68c5c08abe99 100644
--- a/scripts/TargetListToCoords.py
+++ b/scripts/TargetListToCoords.py
@@ -30,13 +30,11 @@ def plugin_main(**kwargs):
     if mode == 'delay_calibration':
         RA_val = [RA_val[0]]
         DEC_val = [DEC_val[0]]
-        Source_id = Source_id[:1]
-        if str(Source_id[0])[0:1] == 'I':
-            pass
-        elif str(Source_id[0])[0:1] == 'S':
+        Source_id = Source_id[0]
+        if isinstance(Source_id, str):
             pass
         else:
-            Source_id = ['S' + str(x) for x in Source_id[0]]
+            Source_id = ['S' + str(Source_id)]
 
     # make a string of coordinates for the DP3 command
     ss = [ '[' + str(x) + 'deg,' + str(y) + 'deg]' for x, y in zip(RA_val, DEC_val) ]
@@ -49,6 +47,4 @@ def plugin_main(**kwargs):
                         + " \"delay_calibration\", \"split_directions\""
                         + f" but was {mode}.")
 
-    result = {'name' : ",".join(Source_id),
-              'coords' : ss}
-    return result
+    return {'name' : ",".join(Source_id), 'coords' : ss}