diff --git a/ssh-tunnel-manager.conf.example b/ssh-tunnel-manager.conf.example
index d1e80b840d427ad5f0a714d5b96e8a8af46a0e51..f43c788011566cca6153feb4169380f6b3bf4c61 100644
--- a/ssh-tunnel-manager.conf.example
+++ b/ssh-tunnel-manager.conf.example
@@ -13,7 +13,7 @@
 
 #
 # Define names for the tunnel to identify them. The list needs to be configured 
-# in the same order as the tunnel config in the TUNELS list.
+# in the same order as the tunnel config in the TUNNELS list.
 #
 #TUNNEL_NAMES=(
 #	"Tunnel-A"
@@ -30,6 +30,16 @@
 #	"-p 1234 username@host2.example.com -L 10002:127.0.0.1:3306 -L 10012:127.0.0.1:27017"
 #)
 
+#
+# The SOCKETS array is used to configure sockets forwarded by individual
+# ports. Each forwarded socket must be removed before it can be forwarded
+# again, which this handles.
+#
+#SOCKETS=(
+#    ""
+#    ""
+#)
+
 #
 # The RECONNECT_TIMER is used in case of a tunnel connection to be lost. After 
 # the script is detecting that the connection was lost, the time defines the 
diff --git a/ssh-tunnel-manager.sh b/ssh-tunnel-manager.sh
index e9c2c96fe484c13017e14195bd14bb8fc61ce06a..0994e4198d28e8ef86d77615a96efd7c8120d3c3 100755
--- a/ssh-tunnel-manager.sh
+++ b/ssh-tunnel-manager.sh
@@ -270,7 +270,7 @@ SCRIPT_PID=$$
 # start procedure according to the action
 #
 case $COMMAND in
-    restart)
+	restart)
 		echotime "COMM - Execute RESTART procedure ... "
 		$0 --config $CONFIG_FILE stop $COMMAND_INDEX_NAME
 		sleep 2
@@ -313,8 +313,13 @@ case $COMMAND in
 				kill $PID &>/dev/null
 			done
 
+			if [ -e "${SOCKETS[$idx]}" ]; then
+				echo "Removing socket '${SOCKETS[$idx]}' ..."
+				rm ${SOCKETS[$idx]}
+			fi
+
 			echotime "STOP - Stopped tunnel '${TUNNEL_NAMES[$idx]}' (ID $idx) ... PID: $RESULT_PID"
-			
+
 			# check if the tunnels really down
 			sleep "0.3"
 			TUNNELS_COUNT=0
@@ -402,6 +407,11 @@ case $COMMAND in
 				echotime "START - Already running tunnel '${TUNNEL_NAMES[$idx]}' (ID $idx) ... PID: $RESULT_PID"
 				echo "Starting tunnel '${TUNNEL_NAMES[$idx]}' ... Already running"
 			else
+				if [ -e "${SOCKETS[$idx]}" ]; then
+					echo "Removing socket '${SOCKETS[$idx]}' ..."
+					rm ${SOCKETS[$idx]}
+				fi
+
 				$0 --config $CONFIG_FILE manage $idx &
 				sleep "0.2"
 				RESULT_PID=`ps aux | grep -v grep | grep "$0 --config $CONFIG_FILE manage $idx" | awk '{print $2}' | tr '\n' ' '`
@@ -409,7 +419,7 @@ case $COMMAND in
 				echotime "START - Starting tunnel '${TUNNEL_NAMES[$idx]}' (ID $idx) ... PID: $RESULT_PID"
 				echo "Starting tunnel '${TUNNEL_NAMES[$idx]}' ... Done"
 			fi
-			# sleep before every cycle to aviod overloading 
+			# sleep before every cycle to aviod overloading
 		done
 		echotime "COMM - Execute START procedure ... Done"
 		echotime ""
@@ -430,4 +440,3 @@ case $COMMAND in
 		done
 		;;
 esac
-