diff --git a/b9.cabal b/b9.cabal
--- a/b9.cabal
+++ b/b9.cabal
@@ -1,5 +1,5 @@
 name: b9
-version: 0.5.31
+version: 0.5.32
 cabal-version: >=1.22
 build-type: Simple
 license: MIT
@@ -88,33 +88,33 @@
     build-depends:
         ConfigFile >=1.1.4,
         QuickCheck >=2.5,
-        aeson >=0.11.2.1,
-        async >=2.1.0,
+        aeson >=1.0.2.1,
+        async >=2.1.1.1,
         base >=4.8 && <5,
         binary >=0.8.3.0,
         bytestring >=0.10.8.1,
-        conduit >=1.2.8,
-        conduit-extra >=1.1.15,
-        directory >=1.2.6.2,
-        filepath >=1.4.1.0,
-        hashable >=1.2.4.0,
+        conduit >=1.2.11,
+        conduit-extra >=1.1.16,
+        directory >=1.3.0.0,
+        filepath >=1.4.1.1,
+        hashable >=1.2.6.1,
         mtl >=2.2.1,
         time >=1.6.0.1,
-        parallel >=3.2.1.0,
+        parallel >=3.2.1.1,
         parsec >=3.1.11,
-        pretty-show >=1.6.12,
+        pretty-show >=1.6.13,
         pretty >=1.1.3.3,
-        process >=1.4.2.0,
+        process >=1.4.3.0,
         random >=1.1,
         semigroups >=0.18.2,
         syb >=0.6,
         template >=0.2.0.10,
         text >=1.2.2.1,
         transformers >=0.5.2.0,
-        unordered-containers >=0.2.7.1,
+        unordered-containers >=0.2.8.0,
         vector >=0.11.0.0,
-        yaml >=0.8.20,
-        bifunctors >=5.4.1,
+        yaml >=0.8.23.1,
+        bifunctors >=5.4.2,
         free >=4.12.4,
         boxes >=0.1.4
     default-language: Haskell2010
@@ -133,11 +133,11 @@
         ghc-options: -fno-warn-amp
     main-is: Main.hs
     build-depends:
-        b9 >=0.5.31,
+        b9 >=0.5.32,
         base >=4.8 && <5,
-        directory >=1.2.6.2,
+        directory >=1.3.0.0,
         bytestring >=0.10.8.1,
-        optparse-applicative >=0.12.1.0
+        optparse-applicative >=0.13.2.0
     default-language: Haskell2010
     default-extensions: TupleSections GeneralizedNewtypeDeriving
                         DeriveDataTypeable RankNTypes FlexibleContexts GADTs DataKinds
@@ -153,14 +153,14 @@
     main-is: Spec.hs
     build-depends:
         base >=4.8 && <5,
-        b9 >=0.5.31,
-        hspec >=2.2.4,
-        hspec-expectations >=0.7.2,
-        QuickCheck >=2.8.2,
-        aeson >=0.11.2.1,
-        yaml >=0.8.20,
+        b9 >=0.5.32,
+        hspec >=2.4.3,
+        hspec-expectations >=0.8.2,
+        QuickCheck >=2.5,
+        aeson >=1.0.2.1,
+        yaml >=0.8.23.1,
         vector >=0.11.0.0,
-        unordered-containers >=0.2.7.1,
+        unordered-containers >=0.2.8.0,
         bytestring >=0.10.8.1,
         text >=1.2.2.1,
         semigroups >=0.18.2
diff --git a/src/lib/B9/Content/ErlTerms.hs b/src/lib/B9/Content/ErlTerms.hs
--- a/src/lib/B9/Content/ErlTerms.hs
+++ b/src/lib/B9/Content/ErlTerms.hs
@@ -67,10 +67,14 @@
 prettyPrintErlTerm (ErlAtom a) = PP.text quotedAtom
   where
     quotedAtom =
-      if all (`elem` (['a'..'z']++['A'..'Z']++['0'..'9']++"@_")) a'
-        then a'
-        else "'"++a'++"'"
-    a' = toErlAtomString a
+      case toErlAtomString a of
+        "" -> "''"
+        a'@(firstChar:rest)
+          | firstChar `elem` ['a' .. 'z'] &&
+              all (`elem` atomCharsThatDontNeedQuoting) rest -> a'
+        a' -> "'" ++ a' ++ "'"
+    atomCharsThatDontNeedQuoting =
+      ['a' .. 'z'] ++ ['A' .. 'Z'] ++ ['0' .. '9'] ++ "@_"
 
 prettyPrintErlTerm (ErlBinary []) = PP.text "<<>>"
 prettyPrintErlTerm (ErlBinary b) = PP.text ("<<\"" ++ toErlStringString b ++ "\">>")
diff --git a/src/tests/B9/Content/ErlTermsSpec.hs b/src/tests/B9/Content/ErlTermsSpec.hs
--- a/src/tests/B9/Content/ErlTermsSpec.hs
+++ b/src/tests/B9/Content/ErlTermsSpec.hs
@@ -122,6 +122,14 @@
        (renderErlTerm (ErlAtom " $s\"<\\.0_=@\ESC'")
        `shouldBe` "' $s\"<\\\\.0_=@\\x{1b}\\''.")
 
+    it "renders _ correctly as '_'"
+       (renderErlTerm (ErlAtom "_")
+       `shouldBe` "'_'.")
+
+    it "renders an empty string correctly as ''"
+       (renderErlTerm (ErlAtom "")
+       `shouldBe` "''.")
+
     it "renders a string and escapes special characters"
        (renderErlTerm (ErlString "' $s\"<\\.0_=@\ESC''")
        `shouldBe` "\"' $s\\\"<\\\\.0_=@\\x{1b}''\".")
diff --git a/stack.yaml b/stack.yaml
--- a/stack.yaml
+++ b/stack.yaml
@@ -2,5 +2,5 @@
 packages:
 - '.'
 extra-deps: []
-resolver: lts-7.9
+resolver: lts-8.22
 pvp-bounds: lower
