diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+# 0.6.0.2
+
+* Fix a bug [(#71)][issue71] which sometimes caused the code generator
+  to crash.
+
+# 0.6.0.1
+
+* Fix a bug in the code generator [(#72)][issue72] which sometimes
+  resulted in build failures of the generated code.
+
 # 0.6.0.0
 
 ## RPC
@@ -112,5 +122,7 @@
 
 * First release; basic read & write support, serialization only.
 
-[issue41]: https://github.com/zenhack/haskell-capnp/issues/41
 [issue34]: https://github.com/zenhack/haskell-capnp/issues/34
+[issue41]: https://github.com/zenhack/haskell-capnp/issues/41
+[issue71]: https://github.com/zenhack/haskell-capnp/issues/71
+[issue72]: https://github.com/zenhack/haskell-capnp/issues/72
diff --git a/capnp.cabal b/capnp.cabal
--- a/capnp.cabal
+++ b/capnp.cabal
@@ -1,6 +1,6 @@
 cabal-version:            2.2
 name:                     capnp
-version:                  0.6.0.1
+version:                  0.6.0.2
 category:                 Data, Serialization, Network, Rpc
 copyright:                2016-2020 haskell-capnp contributors (see CONTRIBUTORS file).
 author:                   Ian Denhardt
diff --git a/cmd/capnpc-haskell/Trans/CgrToStage1.hs b/cmd/capnpc-haskell/Trans/CgrToStage1.hs
--- a/cmd/capnpc-haskell/Trans/CgrToStage1.hs
+++ b/cmd/capnpc-haskell/Trans/CgrToStage1.hs
@@ -35,8 +35,9 @@
         { nodeCommon = Stage1.NodeCommon
             { nodeId = id
             , nodeNested =
-                [ (Name.UnQ name, outMap M.! id)
+                [ (Name.UnQ name, node)
                 | Schema.Node'NestedNode{name, id} <- V.toList nestedNodes
+                , Just node <- [M.lookup id outMap]
                 ]
             , nodeParent =
                 if scopeId == 0 then
