diff --git a/files/lib/gluon/ssid-changer/ssid-changer.sh b/files/lib/gluon/ssid-changer/ssid-changer.sh
index ef07d3ebef2e65174ddf712d597ae78d1341dc4e..73b10033f5848a57ac329980619a1da81cfa7690 100755
--- a/files/lib/gluon/ssid-changer/ssid-changer.sh
+++ b/files/lib/gluon/ssid-changer/ssid-changer.sh
@@ -21,6 +21,12 @@ fi
 
 #Is there an active Gateway?
 GATEWAY_TQ=`batctl gwl | grep "^=>" | awk -F'[()]' '{print $2}'| tr -d " "` #Grep the Connection Quality of the Gateway which is currently used
+
+if [ ! $GATEWAY_TQ ]; #If there is no gateway there will be errors in the following if clauses
+then
+	GATEWAY_TQ=0 #Just an easy way to get an valid value if there is no gatway
+fi
+
 if [ $GATEWAY_TQ -gt $UPPER_LIMIT ];
 then
 	echo "Gateway TQ is $GATEWAY_TQ node is online"