diff --git a/editor/js/graph.js b/editor/js/graph.js
index 86184ddc0ab0a2c5618586ebcbb18d57a9ac9d3d..29badadc8014ef00fc9cd4667e52203f7e15c574 100644
--- a/editor/js/graph.js
+++ b/editor/js/graph.js
@@ -65,7 +65,7 @@ export class Graph extends ManagedData {
     }
 
     getLinkColor(link) {
-        return this.getLinkTypeColor(link[LINK_TYPE])
+        return this.getLinkTypeColor(link[LINK_TYPE]);
     }
 
     getLinkTypeColor(linkClass) {
@@ -223,10 +223,18 @@ export class Graph extends ManagedData {
     getCleanLink(link, simulationParameters) {
         var cleanLink = {};
 
-        // Source and target nodes
-        // Node ids will be converted to complete node objects on running graphs, gotta convert back
-        cleanLink[LINK_SOURCE] = link[LINK_SOURCE][NODE_ID];
-        cleanLink[LINK_TARGET] = link[LINK_TARGET][NODE_ID];
+        // Assuming that all nodes are valid, there are two possible formats
+        // 1. source and target are node objects
+        if (link[LINK_SOURCE][NODE_ID] !== undefined) {
+            // Source and target nodes
+            // Node ids will be converted to complete node objects on running graphs, gotta convert back
+            cleanLink[LINK_SOURCE] = link[LINK_SOURCE][NODE_ID];
+            cleanLink[LINK_TARGET] = link[LINK_TARGET][NODE_ID];
+        } else {
+            // 2. source and target are just node ids
+            cleanLink[LINK_SOURCE] = link[LINK_SOURCE];
+            cleanLink[LINK_TARGET] = link[LINK_TARGET];
+        }
 
         // Other parameters
         LINK_PARAMS.forEach((param) => {