diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py
index e6e55c8684c8ae2e8078aef430e8f213929b0a39..8945c92d018780d2c7537498e75d6044382e1285 100644
--- a/src/common/connection_handlers_events.py
+++ b/src/common/connection_handlers_events.py
@@ -1216,7 +1216,7 @@ class GcInvitationReceivedEvent(nec.NetworkIncomingEvent):
             self.is_continued = False
             if invite_tag.getAttr('continue') == 'true':
                 self.is_continued = True
-        else
+        else:
             self.room_jid = self.msg_obj.fjid
             item = self.msg_obj.invite_tag.getTag('invite')
             try:
diff --git a/src/common/crypto.py b/src/common/crypto.py
index 0b45cbac13117e66ff7d9c8b10ae62309e3ff325..e8ee300a590e2bdea493972c64a258bdd533ab51 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), 0.01)
+        OpenSSL.rand.add(str(s).encode('utf-8'), 0.01)
 
     # On Windows add the current contents of the screen to the PRNG state.
     if os.name == 'nt':
@@ -99,12 +99,13 @@ def add_entropy_sources_OpenSSL():
         for d in dirs:
             if os.access(d, os.R_OK):
                for filename in os.listdir(d):
-                  OpenSSL.rand.add(filename, 0)
+                  OpenSSL.rand.add(filename.encode('utf-8'), 0)
                   try:
                      with open(d + os.sep + filename, "r") as fp:
                          # Limit the ammount of read bytes, in case a memory
                          # file was opened
-                         OpenSSL.rand.add(str(fp.read(5000)), 0.01)
+                         OpenSSL.rand.add(str(fp.read(5000)).encode('utf-8'),
+                             0.01)
                   except:
                       # Ignore all read and access errors
                       pass
diff --git a/src/common/jingle_content.py b/src/common/jingle_content.py
index c417f704dd52c3988686f6f603e1a843186eec96..2634957c64ba5d624bcb956118b5ceb47f485856 100644
--- a/src/common/jingle_content.py
+++ b/src/common/jingle_content.py
@@ -21,8 +21,8 @@ import os
 from common import gajim
 import nbxmpp
 from common.jingle_transport import JingleTransportIBB
-from jingle_xtls import SELF_SIGNED_CERTIFICATE
-from jingle_xtls import load_cert_file
+from .jingle_xtls import SELF_SIGNED_CERTIFICATE
+from .jingle_xtls import load_cert_file
 
 contents = {}
 
diff --git a/src/common/jingle_ft.py b/src/common/jingle_ft.py
index 54f5eb91901807f470e1adb3d2ec18a45d55003e..edd1d3284d5f1b6fbd0f65b3cf0a4740657db524 100644
--- a/src/common/jingle_ft.py
+++ b/src/common/jingle_ft.py
@@ -22,7 +22,7 @@ Handles  Jingle File Transfer (XEP 0234)
 import hashlib
 from common import gajim
 import nbxmpp
-import jingle_xtls
+from . import jingle_xtls
 from common.jingle_content import contents, JingleContent
 from common.jingle_transport import *
 from common import helpers
diff --git a/src/common/jingle_xtls.py b/src/common/jingle_xtls.py
index b238cf7351e970d0a1e50a9cd33170f8bb2c8839..caf0331b6d33dd6fb895eccf2145e0b57d147ea1 100644
--- a/src/common/jingle_xtls.py
+++ b/src/common/jingle_xtls.py
@@ -286,7 +286,7 @@ def make_certs(filepath, CN):
     req = createCertRequest(key, CN=CN)
     cert = createCertificate(req, req, key, 0, 0, 60*60*24*365*5) # five years
     with open(filepath + '.pkey', 'wb') as f:
-        os.chmod(filepath + '.pkey', 0600)
+        os.chmod(filepath + '.pkey', 0o600)
         f.write(crypto.dump_privatekey(crypto.FILETYPE_PEM, key))
     with open(filepath + '.cert', 'wb') as f:
         f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert).decode(
diff --git a/src/common/socks5.py b/src/common/socks5.py
index 9ccfa92c2bd372200e33eaeab58545b0976468be..86a551823565dfac8b73c8a74a5c66462192456a 100644
--- a/src/common/socks5.py
+++ b/src/common/socks5.py
@@ -494,7 +494,7 @@ class Socks5(object):
             self._sock.connect(self._server)
             self._send=self._sock.send
             self._recv=self._sock.recv
-        except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError), e:
+        except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError) as e:
             pass
         except Exception as ee:
             errnum = ee.errno
diff --git a/src/gui_interface.py b/src/gui_interface.py
index 9a314be611cedd944e68d26fcdbbff1ad5ff340f..319ab6994cf50c2194d3c3f31141a2c0afeac355 100644
--- a/src/gui_interface.py
+++ b/src/gui_interface.py
@@ -1971,7 +1971,7 @@ class Interface:
                 import imp
                 imp.reload(emoticons)
             emots = emoticons.emoticons
-         except Exception, e:
+        except Exception as e:
             return True
         for emot_filename in emots:
             emot_file = os.path.join(path, emot_filename)