diff --git a/src/common/crypto.py b/src/common/crypto.py
index e8ee300a590e2bdea493972c64a258bdd533ab51..70ef6e1e129674d700884912290c52c572ffa846 100644
--- a/src/common/crypto.py
+++ b/src/common/crypto.py
@@ -87,7 +87,7 @@ def add_entropy_sources_OpenSSL():
         os.environ, os.getcwd(), os.getpid()]
 
     for s in sources:
-        OpenSSL.rand.add(str(s).encode('utf-8'), 0.01)
+        OpenSSL.rand.add(str(s).encode('utf-8'), 1)
 
     # On Windows add the current contents of the screen to the PRNG state.
     if os.name == 'nt':
@@ -105,7 +105,7 @@ def add_entropy_sources_OpenSSL():
                          # Limit the ammount of read bytes, in case a memory
                          # file was opened
                          OpenSSL.rand.add(str(fp.read(5000)).encode('utf-8'),
-                             0.01)
+                             1)
                   except:
                       # Ignore all read and access errors
                       pass
diff --git a/src/common/jingle_xtls.py b/src/common/jingle_xtls.py
index caf0331b6d33dd6fb895eccf2145e0b57d147ea1..864cc5f057691edb45a98f8d8c3cb827a28a641b 100644
--- a/src/common/jingle_xtls.py
+++ b/src/common/jingle_xtls.py
@@ -118,7 +118,7 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None):
     dh_params_name = os.path.join(gajim.MY_CERT_DIR, DH_PARAMS)
     try:
         with open(dh_params_name, "r") as dh_params_file:
-            ctx.load_tmp_dh(dh_params_name)
+            ctx.load_tmp_dh(str(dh_params_name).encode('utf-8'))
     except IOError as err:
         log.warn('Unable to load DH parameter file: %s. You should generate it '
             'by using this command : "openssl dhparam 4096 -out '
@@ -128,7 +128,7 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None):
             'other', DEFAULT_DH_PARAMS)
         try:
             with open(default_dh_params_name, "r") as default_dh_params_file:
-                ctx.load_tmp_dh(default_dh_params_name)
+                ctx.load_tmp_dh(str(default_dh_params_name).encode('utf-8'))
         except IOError as err:
             log.error('Unable to load default DH parameter file: %s , %s'
                 % (default_dh_params_name, err))
diff --git a/src/gajim.py b/src/gajim.py
index 8f55214b899eee1f5b605ca261ec4fdd601f5f73..f07badff8e51faa2052f6183f131498cbfc4ba83 100644
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -320,7 +320,7 @@ try:
     from common import crypto
     PYOPENSSL_PRNG_PRESENT = True
     # Seed from file
-    OpenSSL.rand.load_file(RNG_SEED)
+    OpenSSL.rand.load_file(str(RNG_SEED).encode('utf-8'))
     crypto.add_entropy_sources_OpenSSL()
 except ImportError:
     log.info("PyOpenSSL PRNG not available")
@@ -473,7 +473,7 @@ del pid_dir
 def on_exit():
     # Save the entropy from OpenSSL PRNG
     if PYOPENSSL_PRNG_PRESENT:
-        OpenSSL.rand.write_file(RNG_SEED)
+        OpenSSL.rand.write_file(str(RNG_SEED).encode('utf-8'))
     # delete pid file on normal exit
     if os.path.exists(pid_filename):
         os.remove(pid_filename)