diff --git a/OBSW_TmTcClient.py b/OBSW_TmTcClient.py
index 7313cf076b5f9c4b7a71d582c1c004879b6f5ea3..a930fc4db8c476c493a2b444ed0d1fc60fcc5624 100644
--- a/OBSW_TmTcClient.py
+++ b/OBSW_TmTcClient.py
@@ -154,21 +154,23 @@ def setCommunicationInterface(tmtcPrinter: TmTcPrinterT) -> ComIF_T:
     :param tmtcPrinter: TmTcPrinter object.
     :return: CommunicationInterface object
     """
+    communicationInterface = None
     try:
-        if g.comIF == 0 and g.modeId != "OBSWUnitTest":
+        if g.comIF == 0 and g.modeId != g.modeList.UnitTest:
             communicationInterface = EthernetComIF(tmtcPrinter, g.tmTimeout, g.tcSendTimeoutFactor,
                                                    g.sockSend, g.sockReceive, g.sendAddress)
-        elif g.modeId != "OBSWUnitTest":
+        elif g.modeId != g.modeList.UnitTest:
             comPort = g.comPort
             baudRate = 115200
             g.serialTimeout = 0.05
             communicationInterface = SerialComIF(tmtcPrinter, comPort, baudRate, g.serialTimeout)
         else:
-            communicationInterface = 0
+            print("Could not set up communication interface !")
+            exit()
         return communicationInterface
     except (IOError, OSError):
         print("Error setting up communication interface")
-        logging.exception("Error: ")
+        logging.exception("Error")
         exit()
 
 
diff --git a/config/OBSW_Config.py b/config/OBSW_Config.py
index a6f3246bc77f7f1346a43b1cb1b7fe0745aa8f33..06f4c0106152826850cd17596c0c2f9cad722ab4 100644
--- a/config/OBSW_Config.py
+++ b/config/OBSW_Config.py
@@ -112,3 +112,4 @@ def setGlobals(args):
 def setGlobalsUnitTest():
     global sockReceive
     sockReceive = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+