diff --git a/README.rst b/README.rst
index 640d397b8222b6f36b9baf4ad62631e67c4a02b3..05eb93b5b7d94dc0cf860bc837086cd7f3d52081 100644
--- a/README.rst
+++ b/README.rst
@@ -2,7 +2,7 @@ beem - Unofficial Python Library for Steem
 ===============================================
 
 beem is an unofficial python library for steem, which is created new from scratch from `python-bitshares`_
-The library name is derived from a beam maschine, similar to the analogy between steem and steam. beem includes `python-graphenelib`_.
+The library name is derived from a beam machine, similar to the analogy between steem and steam. beem includes `python-graphenelib`_.
 
 .. image:: https://img.shields.io/pypi/v/beem.svg
     :target: https://pypi.python.org/pypi/beem/
diff --git a/beemgraphenebase/account.py b/beemgraphenebase/account.py
index 3542acb6d6a1195b0385c53de575dd81b2bc228d..c175ba863c2084ce77a041fad55b32f12ba975bf 100644
--- a/beemgraphenebase/account.py
+++ b/beemgraphenebase/account.py
@@ -132,7 +132,10 @@ class BrainKey(object):
         if not len(dict_lines) == 49744:
             raise AssertionError()
         for j in range(0, word_count):
-            num = int.from_bytes(os.urandom(2), byteorder="little")
+            urand = os.urandom(2)
+            if isinstance(urand, str):
+                urand = py23_bytes(urand, 'ascii')
+            num = int.from_bytes(urand, byteorder="little")
             rndMult = num / 2 ** 16  # returns float between 0..1 (inclusive)
             wIdx = round(len(dict_lines) * rndMult)
             brainkey[j] = dict_lines[wIdx]
diff --git a/tests/beem/test_cli.py b/tests/beem/test_cli.py
index 840b7965e7cb31f3627d6ac7a6e7dceb20acb6a5..44475e5a20015cfb707da837d4071cfc49161574 100644
--- a/tests/beem/test_cli.py
+++ b/tests/beem/test_cli.py
@@ -145,6 +145,11 @@ class Testcases(unittest.TestCase):
         result = runner.invoke(cli, ['walletinfo'])
         self.assertEqual(result.exit_code, 0)
 
+    def test_keygen(self):
+        runner = CliRunner()
+        result = runner.invoke(cli, ['keygen'])
+        self.assertEqual(result.exit_code, 0)
+
     def test_set(self):
         runner = CliRunner()
         result = runner.invoke(cli, ['-o', 'set', 'set_default_vote_weight', '100'])
diff --git a/tests/beemgraphene/test_account.py b/tests/beemgraphene/test_account.py
index fbd387cb31e8f2da4df476f63c404c5c760d1eb4..ad5ccdf03bf6a95b662d486b98e9875f776ae21f 100644
--- a/tests/beemgraphene/test_account.py
+++ b/tests/beemgraphene/test_account.py
@@ -157,6 +157,10 @@ class Testcases(unittest.TestCase):
                           ],
                          [b, b, b, b, b, b, b])
 
+    def test_BrainKey_suggest(self):
+        b = BrainKey()
+        self.assertTrue(len(b.suggest()) > 0)
+
     def test_BrainKey_sequences(self):
         b = BrainKey("COLORER BICORN KASBEKE FAERIE LOCHIA GOMUTI SOVKHOZ Y GERMAL AUNTIE PERFUMY TIME FEATURE GANGAN CELEMIN MATZO")
         keys = ["5Hsbn6kXio4bb7eW5bX7kTp2sdkmbzP8kGWoau46Cf7en7T1RRE",