Index: binary-improvements2/MapRendering/Commands/EnableOpenIDDebug.cs
===================================================================
--- binary-improvements2/MapRendering/Commands/EnableOpenIDDebug.cs	(revision 382)
+++ binary-improvements2/MapRendering/Commands/EnableOpenIDDebug.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System;
 using System.Collections.Generic;
 using AllocsFixes.NetConnections.Servers.Web;
Index: binary-improvements2/MapRendering/Commands/EnableRendering.cs
===================================================================
--- binary-improvements2/MapRendering/Commands/EnableRendering.cs	(revision 382)
+++ binary-improvements2/MapRendering/Commands/EnableRendering.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System;
 using System.Collections.Generic;
 
Index: binary-improvements2/MapRendering/Commands/ReloadWebPermissions.cs
===================================================================
--- binary-improvements2/MapRendering/Commands/ReloadWebPermissions.cs	(revision 382)
+++ binary-improvements2/MapRendering/Commands/ReloadWebPermissions.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System;
 using System.Collections.Generic;
 using AllocsFixes.NetConnections.Servers.Web;
Index: binary-improvements2/MapRendering/Commands/RenderMap.cs
===================================================================
--- binary-improvements2/MapRendering/Commands/RenderMap.cs	(revision 382)
+++ binary-improvements2/MapRendering/Commands/RenderMap.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System;
 using System.Collections.Generic;
 
Index: binary-improvements2/MapRendering/Commands/webstat.cs
===================================================================
--- binary-improvements2/MapRendering/Commands/webstat.cs	(revision 382)
+++ binary-improvements2/MapRendering/Commands/webstat.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System;
 using System.Collections.Generic;
 using AllocsFixes.NetConnections.Servers.Web;
Index: binary-improvements2/MapRendering/MapRendering/MapRendering.cs
===================================================================
--- binary-improvements2/MapRendering/MapRendering/MapRendering.cs	(revision 382)
+++ binary-improvements2/MapRendering/MapRendering/MapRendering.cs	(revision 383)
@@ -24,4 +24,5 @@
 		private bool renderingFullMap;
 		private float renderTimeout = float.MaxValue;
+		private bool shutdown;
 
 		private MapRendering () {
@@ -59,5 +60,11 @@
 
 		public static void Shutdown () {
-			if (Instance?.renderCoroutineRef != null) {
+			if (Instance == null) {
+				return;
+			}
+
+			Instance.shutdown = true;
+			
+			if (Instance.renderCoroutineRef != null) {
 				ThreadManager.StopCoroutine (Instance.renderCoroutineRef);
 				Instance.renderCoroutineRef = null;
@@ -201,7 +208,7 @@
 
 		private IEnumerator renderCoroutine () {
-			while (true) {
+			while (!shutdown) {
 				lock (lockObject) {
-					if (dirtyChunks.Count > 0 && renderTimeout == float.MaxValue) {
+					if (dirtyChunks.Count > 0 && renderTimeout >= float.MaxValue / 2) {
 						renderTimeout = Time.time + 0.5f;
 					}
@@ -239,7 +246,5 @@
 			//Log.Out ("Start Dirty: " + chunkPos);
 
-			Vector2i block, blockOffset;
-			getBlockNumber (chunkPos, out block, out blockOffset, Constants.MAP_BLOCK_TO_CHUNK_DIV,
-				Constants.MAP_CHUNK_SIZE);
+			getBlockNumber (chunkPos, out Vector2i block, out _, Constants.MAP_BLOCK_TO_CHUNK_DIV, Constants.MAP_CHUNK_SIZE);
 
 			zoomLevelBuffers [Constants.ZOOMLEVELS - 1].LoadBlock (block);
Index: binary-improvements2/MapRendering/Web/API/GetAllowedCommands.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetAllowedCommands.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetAllowedCommands.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System.Net;
 using AllocsFixes.JSON;
 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
Index: binary-improvements2/MapRendering/Web/API/GetAnimalsLocation.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetAnimalsLocation.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetAnimalsLocation.cs	(revision 383)
@@ -1,4 +1,3 @@
 ﻿using System.Collections.Generic;
-using System.Net;
 using AllocsFixes.JSON;
 using AllocsFixes.LiveData;
Index: binary-improvements2/MapRendering/Web/API/GetHostileLocation.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetHostileLocation.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetHostileLocation.cs	(revision 383)
@@ -1,4 +1,3 @@
 ﻿using System.Collections.Generic;
-using System.Net;
 using AllocsFixes.JSON;
 using AllocsFixes.LiveData;
Index: binary-improvements2/MapRendering/Web/API/GetLog.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetLog.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetLog.cs	(revision 383)
@@ -1,4 +1,3 @@
 using System.Collections.Generic;
-using System.Net;
 using AllocsFixes.JSON;
 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
Index: binary-improvements2/MapRendering/Web/API/GetPlayerInventories.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetPlayerInventories.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetPlayerInventories.cs	(revision 383)
@@ -1,4 +1,3 @@
 using System.Collections.Generic;
-using System.Net;
 using AllocsFixes.JSON;
 using AllocsFixes.PersistentData;
Index: binary-improvements2/MapRendering/Web/API/GetPlayerList.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetPlayerList.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetPlayerList.cs	(revision 383)
@@ -2,5 +2,4 @@
 using System.Collections.Generic;
 using System.Linq;
-using System.Net;
 using System.Text.RegularExpressions;
 using AllocsFixes.JSON;
Index: binary-improvements2/MapRendering/Web/API/GetPlayersLocation.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetPlayersLocation.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetPlayersLocation.cs	(revision 383)
@@ -1,4 +1,3 @@
 using System.Collections.Generic;
-using System.Net;
 using AllocsFixes.JSON;
 using AllocsFixes.PersistentData;
Index: binary-improvements2/MapRendering/Web/API/GetPlayersOnline.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetPlayersOnline.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetPlayersOnline.cs	(revision 383)
@@ -1,4 +1,3 @@
 using System.Collections.Generic;
-using System.Net;
 using AllocsFixes.JSON;
 using AllocsFixes.PersistentData;
Index: binary-improvements2/MapRendering/Web/API/GetServerInfo.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetServerInfo.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetServerInfo.cs	(revision 383)
@@ -1,4 +1,3 @@
 using System;
-using System.Net;
 using AllocsFixes.JSON;
 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
Index: binary-improvements2/MapRendering/Web/API/GetStats.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetStats.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetStats.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System.Net;
 using AllocsFixes.JSON;
 using AllocsFixes.LiveData;
Index: binary-improvements2/MapRendering/Web/API/GetWebUIUpdates.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/GetWebUIUpdates.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/GetWebUIUpdates.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System.Net;
 using AllocsFixes.JSON;
 using AllocsFixes.LiveData;
Index: binary-improvements2/MapRendering/Web/API/Null.cs
===================================================================
--- binary-improvements2/MapRendering/Web/API/Null.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/API/Null.cs	(revision 383)
@@ -1,4 +1,3 @@
-﻿using System.Net;
-using System.Text;
+﻿using System.Text;
 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
Index: binary-improvements2/MapRendering/Web/Handlers/AbsHandler.cs
===================================================================
--- binary-improvements2/MapRendering/Web/Handlers/AbsHandler.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/Handlers/AbsHandler.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System.Net;
 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
Index: binary-improvements2/MapRendering/Web/Handlers/SimpleRedirectHandler.cs
===================================================================
--- binary-improvements2/MapRendering/Web/Handlers/SimpleRedirectHandler.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/Handlers/SimpleRedirectHandler.cs	(revision 383)
@@ -1,3 +1,2 @@
-using System.Net;
 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
Index: binary-improvements2/MapRendering/Web/Web.cs
===================================================================
--- binary-improvements2/MapRendering/Web/Web.cs	(revision 382)
+++ binary-improvements2/MapRendering/Web/Web.cs	(revision 383)
@@ -164,4 +164,15 @@
 				response.ProtocolVersion = httpProtocolVersion;
 
+				// No game yet -> fail request
+				if (GameManager.Instance.World == null) {
+					response.StatusCode = (int) HttpStatusCode.ServiceUnavailable;
+					return;
+				}
+
+				if (request.Url == null) {
+					response.StatusCode = (int) HttpStatusCode.BadRequest;
+					return;
+				}
+
 #if ENABLE_PROFILER
 				authSampler.Begin ();
@@ -172,7 +183,5 @@
 #endif
 
-
 				//Log.Out ("Login status: conn!=null: {0}, permissionlevel: {1}", conn != null, permissionLevel);
-
 
 				if (conn != null) {
@@ -186,10 +195,4 @@
 				}
 
-				// No game yet -> fail request
-				if (GameManager.Instance.World == null) {
-					response.StatusCode = (int) HttpStatusCode.ServiceUnavailable;
-					return;
-				}
-
 				string requestPath = request.Url.AbsolutePath;
 
