diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f37ae53dae489808bbff21517ac42ccd89ae83f5..8c3439a7392b11b6f1a37b58e0f9ffdee5fe5091 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -71,6 +71,18 @@ run-test-3.12-pyside6:
   image: python:3.12
   extends: ".run-test"
 
+run-test-3.13-pyqt6:
+  variables:
+    QT_API: pyqt6
+  image: python:3.13
+  extends: ".run-test"
+
+run-test-3.13-pyside6:
+  variables:
+    QT_API: pyside6
+  image: python:3.13
+  extends: ".run-test"
+
 run-vhdl-tests:
   variables:
     QT_API: pyqt6
diff --git a/b_asic/save_load_structure.py b/b_asic/save_load_structure.py
index 58497f4dcc6404434f5b5df07307f715fc8c3574..8f9622d4982e4d2838c494249ca790fb5a150600 100644
--- a/b_asic/save_load_structure.py
+++ b/b_asic/save_load_structure.py
@@ -150,18 +150,28 @@ def python_to_sfg(path: str) -> Tuple[SFG, Dict[str, Tuple[int, int]]]:
     path : str
         Path to file to read and deserialize.
     """
+    local_vars = {}
+
     with open(path) as file:
         code = compile(file.read(), path, "exec")
-        exec(code, globals(), locals())
-
-    return (
-        (
-            locals()["prop"]["name"]
-            if "prop" in locals()
-            else [v for k, v in locals().items() if isinstance(v, SFG)][0]
-        ),
-        locals()["positions"] if "positions" in locals() else {},
-    )
+        exec(code, globals(), local_vars)
+
+    # access variables from local_vars
+    sfg_object = None
+    if "prop" in local_vars and "name" in local_vars["prop"]:
+        sfg_object = local_vars["prop"]["name"]
+    else:
+        for v in local_vars.values():
+            if isinstance(v, SFG):
+                sfg_object = v
+                break
+
+    positions = local_vars.get("positions", {})
+
+    if sfg_object is None:
+        raise ValueError("No SFG object found in the provided file.")
+
+    return sfg_object, positions
 
 
 def schedule_to_python(schedule: Schedule) -> str: