diff --git a/live_exam_os/Dockerfile b/live_exam_os/Dockerfile
index 620dfeae91c7453b3973de30d4ecb82f41c486ea..96bcbddaa3d22adc49e3170a44a05a0f87b2021c 100644
--- a/live_exam_os/Dockerfile
+++ b/live_exam_os/Dockerfile
@@ -8,7 +8,6 @@ RUN apt-get update && apt-get install -y \
 ARG server_ip
 ARG server_port
 ARG config_dir
-
 #ARG nexus_cert
 
 WORKDIR /live-default
@@ -26,6 +25,8 @@ ADD ${config_dir}/keyboard config/includes.chroot/etc/default/
 ADD ${config_dir}/nexus-exam config/includes.chroot/usr/local/bin/
 ADD ${config_dir}/nexus-exam.desktop config/includes.chroot/etc/xdg/autostart/
 RUN mkdir config/includes.chroot/etc/skel/
+# ADD ${config_dir}/Xsession config/includes.chroot/etc/X11/Xsession.d/99x-user_session
+ADD ${config_dir}/Xsession config/includes.chroot/etc/skel/.xsessionrc
 
 #RUN echo "export NEXUS_SERVER=${server_ip}\nexport NEXUS_CERT=/etc/ssl/certs/nexus-server.pem\n" >> config/includes.chroot/etc/skel/.xsessionrc
 
@@ -52,8 +53,7 @@ ADD ${config_dir}/isolinux_stdmenu.cfg config/includes.binary/isolinux/stdmenu.c
 # script hook ran at boot time (install system wide cert and firewall)
 ADD ${config_dir}/live-exam-hook config/includes.chroot/lib/live/config/9999-custom
 # update server destination from docker's variable (all others IP are banned)
-RUN echo "firewall ${server_ip}\n" >> config/includes.chroot/lib/live/config/9999-custom
-RUN sed s,_SERVER_PORT_,${server_port},g config/includes.chroot/lib/live/config/9999-custom > config/includes.chroot/lib/live/config/9999-custom.new && mv config/includes.chroot/lib/live/config/9999-custom.new config/includes.chroot/lib/live/config/9999-custom
+RUN echo "firewall ${server_ip} ${server_port}\n" >> config/includes.chroot/lib/live/config/9999-custom
 
 # install wifi template
 ADD ${config_dir}/WIFI.nmconnection config/includes.chroot/etc/NetworkManager/system-connections/
diff --git a/live_exam_os/build_live_exam_iso b/live_exam_os/build_live_exam_iso
index 844324f853e428ed05c5a1a08b3d4e5b99c305c2..71b863770df456175d89941e1738b4b724da12b2 100755
--- a/live_exam_os/build_live_exam_iso
+++ b/live_exam_os/build_live_exam_iso
@@ -61,11 +61,11 @@ error=0
 echo "Building nexus-exam ..."
 
 # This script compiles and copies nexus-exam into the current dir
-nexus_exam_builder/build_nexus_exam $SERVER_IP $CERT $EXAM_USER $EXAM_PWD || abort
+nexus_exam_builder/build_nexus_exam $SERVER_IP:$SERVER_PORT $CERT $EXAM_USER $EXAM_PWD || abort
 mv nexus-exam $CONFIG_DIR || abort
 
 echo "Building nexus live exam OS image \"$ISO\" ..."
-echo "Using nexus-server @ $SERVER_IP"
+echo "Using nexus-server @ $SERVER_IP:$SERVER_PORT"
 
 build_docker_image
 
diff --git a/live_exam_os/config/Xsession b/live_exam_os/config/Xsession
new file mode 100644
index 0000000000000000000000000000000000000000..3222364ce4fc830d6c8ee341b7fc9a8d43a166af
--- /dev/null
+++ b/live_exam_os/config/Xsession
@@ -0,0 +1,6 @@
+# Set brightness at 100%
+screen=`xrandr -q|grep ' connected'|head -n1|cut -d ' ' -f1`
+xrandr --output $screen --brightness 0.5
+
+# Disable screen blanking
+xset s off
diff --git a/live_exam_os/config/live-exam-hook b/live_exam_os/config/live-exam-hook
index acabcf699864c359a98acdc78347102be58e1222..b413a788c949ff13bb4d13b36d6f9fb8a2698be1 100755
--- a/live_exam_os/config/live-exam-hook
+++ b/live_exam_os/config/live-exam-hook
@@ -10,41 +10,25 @@
 ## This is free software, and you are welcome to redistribute it
 ## under certain conditions; see COPYING for details.
 
-# This function is here just for reference as it is not used.
-add_nexus_certs ()
-{
-    if [ ! -e /etc/ssl/certs/nexus-server.pem ] && [ -e /usr/share/ca-certificates/nexus-server/nexus-server.crt ]
-    then
-        echo "nexus-server/nexus-server.crt" >> /etc/ca-certificates.conf
-        update-ca-certificates
-    fi
-}
-
-disable_screen_blanking()
-{
-    echo "xset s off" >> /home/nexus/.xsession
-}
-
-max_screen_brightness()
-{
-    brightnessctl set 100%
-}
+# add_nexus_certs ()
+# {
+#     if [ ! -e /etc/ssl/certs/nexus-server.pem ] && [ -e /usr/share/ca-certificates/nexus-server/nexus-server.crt ]
+#     then
+#         echo "nexus-server/nexus-server.crt" >> /etc/ca-certificates.conf
+#         update-ca-certificates
+#     fi
+# }
 
 firewall ()
 {
     ufw default deny incoming
     ufw default deny outgoing
-    ufw allow in from any port 68 to any port 67 proto udp
-    ufw allow from any to any port 80
-    ufw allow from any to any port 443
-    ufw allow from any to any port _SERVER_PORT_
+    ufw allow out from any to $1 port 80
+    ufw allow out from any to $1 port 443
+    ufw allow out from any to $1 port $2
     ufw allow out from any to $1 port 1025:65535 proto tcp
     ufw allow out from any to $1 port 1025:65535 proto udp
-    # ufw allow from any to any port 22
     ufw enable
 }
 
-#add_nexus_certs
-
-#max_screen_brightness
-#disable_screen_blanking
+# add_nexus_certs
\ No newline at end of file
diff --git a/src/client/nexus-exam/nexus-exam.go b/src/client/nexus-exam/nexus-exam.go
index 5ceed6e7c11eb02755de2c35e06b0592fb727812..104e5cbf31bd1bf0eca27e1eafb2d376dbd4f1d9 100644
--- a/src/client/nexus-exam/nexus-exam.go
+++ b/src/client/nexus-exam/nexus-exam.go
@@ -42,7 +42,9 @@ var (
 )
 
 func exit(code int) {
-    exitFn()
+    if exitFn != nil {
+        exitFn()
+    }
     os.Exit(code)
 }