diff --git a/codec-beam.cabal b/codec-beam.cabal
--- a/codec-beam.cabal
+++ b/codec-beam.cabal
@@ -1,6 +1,6 @@
 Name: codec-beam
 Category: Language, Codec
-Version: 0.1.1
+Version: 0.2.0
 Maintainer: h.kofigumbs@gmail.com
 Synopsis: Erlang VM byte code assembler
 Description: Erlang VM byte code assembler.
diff --git a/src/Codec/Beam.hs b/src/Codec/Beam.hs
--- a/src/Codec/Beam.hs
+++ b/src/Codec/Beam.hs
@@ -181,7 +181,10 @@
         (value, newTable) =
           Table.index lambda (_lambdaTable env)
       in
-      appendTag (encodeTag 0 value) $ env { _lambdaTable = newTable }
+      appendTag (encodeTag 0 value) $ env
+        { _lambdaTable = newTable
+        , _atomTable = Table.ensure (_lambda_name lambda) $ _atomTable env
+        }
 
     FromInt value ->
       appendTag (encodeTag 1 value) env
@@ -431,8 +434,8 @@
 
 encodeTag :: Word8 -> Int -> [Word8]
 encodeTag tag n
-  | n < 0 = manyBytes tag (negative n [])
-  | n < 0x10 = oneByte tag n
+  | n < 0     = manyBytes tag (negative n [])
+  | n < 0x10  = oneByte tag n
   | n < 0x800 = twoBytes tag n
   | otherwise = manyBytes tag (positive n [])
 
diff --git a/src/Codec/Beam/Instructions.hs b/src/Codec/Beam/Instructions.hs
--- a/src/Codec/Beam/Instructions.hs
+++ b/src/Codec/Beam/Instructions.hs
@@ -601,10 +601,10 @@
 line a1 = Op 153 [FromUntagged a1]
 
 put_map_assoc :: (IsSource a2, IsRegister a3) => Label -> a2 -> a3 -> [(Source, Source)] -> Op
-put_map_assoc a1 a2 a3 a4 = Op 154 [FromLabel a1, fromSource a2, fromRegister a3, FromUntagged (length a4 + 1), fromPairs fromSource a4]
+put_map_assoc a1 a2 a3 a4 = Op 154 [FromLabel a1, fromSource a2, fromRegister a3, FromUntagged (length a4 + 1), fromPairs fromSource fromSource a4]
 
 put_map_exact :: (IsSource a2, IsRegister a3) => Label -> a2 -> a3 -> [(Source, Source)] -> Op
-put_map_exact a1 a2 a3 a4 = Op 155 [FromLabel a1, fromSource a2, fromRegister a3, FromUntagged (length a4 + 1), fromPairs fromSource a4]
+put_map_exact a1 a2 a3 a4 = Op 155 [FromLabel a1, fromSource a2, fromRegister a3, FromUntagged (length a4 + 1), fromPairs fromSource fromSource a4]
 
 is_map :: (IsSource a2) => Label -> a2 -> Op
 is_map a1 a2 = Op 156 [FromLabel a1, fromSource a2]
@@ -617,9 +617,9 @@
   :: (IsSource a2)
     => Label                  -- ^ jump here on failure
     -> a2                     -- ^ where the map is
-    -> [(Register, Register)] -- ^ list of (what key to use, where to put value)
+    -> [(Source, Register)] -- ^ list of (what key to use, where to put value)
     -> Op
-get_map_elements a1 a2 a3 = Op 158 [FromLabel a1, fromSource a2, fromPairs fromRegister a3]
+get_map_elements a1 a2 a3 = Op 158 [FromLabel a1, fromSource a2, fromPairs fromSource fromRegister a3]
 
 -- | Test the type of source and jumps to label if it is not a tuple.
 --   Test the arity of Reg and jumps to label if it is not of the given size.
diff --git a/src/Codec/Beam/Internal/Syntax.hs b/src/Codec/Beam/Internal/Syntax.hs
--- a/src/Codec/Beam/Internal/Syntax.hs
+++ b/src/Codec/Beam/Internal/Syntax.hs
@@ -205,9 +205,9 @@
 -- NOTE: This function reverses tuple order.
 --       Seems to be necessary, but it's rather unintuitive,
 --       given that 'fromDestinations' has opposite behavior.
-fromPairs :: (a -> Argument) -> [(a, a)] -> Argument
-fromPairs from =
-  FromList . foldr (\x a -> from (snd x) : from (fst x) : a) []
+fromPairs :: (a -> Argument) -> (b -> Argument) -> [(a, b)] -> Argument
+fromPairs fromA fromB =
+  FromList . foldr (\(a, b) x -> fromB b : fromA a : x) []
 
 
 class IsBif a where unBif :: Int -> a -> Import
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -283,7 +283,7 @@
         , func_info "test" 2
         , label (Beam.Label 2)
         , get_map_elements (Beam.Label 3) (Beam.X 0)
-            [ (Beam.toRegister (Beam.X 1), Beam.toRegister (Beam.X 0))
+            [ (Beam.toSource (Beam.X 1), Beam.toRegister (Beam.X 0))
             ]
         , return'
         , label (Beam.Label 3)
@@ -328,7 +328,7 @@
         , make_fun2 (Beam.Lambda "lambda_function" 0 (Beam.Label 4) 1)
         , return'
         , label (Beam.Label 3)
-        , func_info "lambda_function" 1
+        , func_info "backing_function" 1
         , label (Beam.Label 4)
         , return'
         ]
