                       (assoc graph ::root run-next)
                       env
                       {::node-id (::run-next node)})
-          next-node (or (get-in new-graph [::nodes run-next])
-                        (get-in graph [::nodes run-next]))]
+          next-node (or (get-node new-graph run-next)
+                        (get-node graph run-next))]
       (-> graph
           (assoc
             ::nodes (::nodes new-graph)

  (if run-next
    (assoc-in graph [::nodes node-id ::run-next] run-next)
    (update-in graph [::nodes node-id] dissoc ::run-next)))

(defn merge-nodes-run-next
  "Updates node-id run-next with the run-next of the last element. This will do an AND

        (not root-node)
        (set-root-node graph node-id)

        (and (pc-sym root-node)
             (= (pc-sym root-node) (pc-sym next-node)))
        (-> (collapse-nodes-branch graph env (::root graph) node-id)
            (set-root-node node-id))

