diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,3 +17,6 @@
 
 ## 0.3.2.1 -- 2021-01-10
 * Add the toExport and fromExport functions to the exported functions in the pure module.
+
+## 0.4.0.0 -- 2021-01-10
+* fromExport function now correctly determines the referece to use for generation of new nodes.
diff --git a/Language/Explorer/Monadic.hs b/Language/Explorer/Monadic.hs
--- a/Language/Explorer/Monadic.hs
+++ b/Language/Explorer/Monadic.hs
@@ -201,4 +201,5 @@
 toExport exp = (currRef exp, IntMap.toList $ cmap exp, labEdges $ execEnv exp)
 
 fromExport :: Explorer p m c o -> (Ref, [(Ref, c)], [(Ref, Ref, (p, o))]) -> Explorer p m c o
-fromExport exp (curr, nds, edgs) = exp { currRef = curr, cmap = IntMap.fromList nds, execEnv = mkGraph (map (\(x, _) -> (x, x)) nds) edgs }
+fromExport exp (curr, nds, edgs) = exp { genRef = findMax nds, currRef = curr, cmap = IntMap.fromList nds, execEnv = mkGraph (map (\(x, _) -> (x, x)) nds) edgs }
+  where findMax l = maximum $ map fst l
diff --git a/exploring-interpreters.cabal b/exploring-interpreters.cabal
--- a/exploring-interpreters.cabal
+++ b/exploring-interpreters.cabal
@@ -1,7 +1,7 @@
 cabal-version:       >=1.10
 
 name:                exploring-interpreters
-version:             0.3.2.1
+version:             0.4.0.0
 synopsis:            A generic exploring interpreter for exploratory programming
 -- synopsis:
 -- description:
