 
   fileprivate func addIndexFileHandler() {
     localServer.addHandler(match: { [weak self] (requestMethod, requestURL, requestHeaders, URLPath, URLQuery) -> GCDWebServerRequest! in
+    localServer.addHandler(match: { [weak self] (requestMethod, requestURL, requestHeaders, urlPath, urlQuery) -> GCDWebServerRequest! in
       if requestMethod != "GET" { return nil }
+      guard let urlPath = urlPath else { return nil }
 
       // Don't serve index.html for local file system paths
-      if (URLPath?.hasPrefix(localFileSystemPath))! { return nil }
-
-      if URLPath == "/favicon.ico" { return nil }
+      if (urlPath.hasPrefix(localFileSystemPath)) { return nil }
+
+      if urlPath == "/favicon.ico" { return nil }
 
       guard let indexFile = self?.currentAssetBundle?.indexFile else { return nil }
 
-      let request = GCDWebServerRequest(method: requestMethod, url: requestURL, headers: requestHeaders, path: URLPath, query: URLQuery)
+      let request = GCDWebServerRequest(method: requestMethod, url: requestURL, headers: requestHeaders, path: urlPath, query: urlQuery)
       request?.setAttribute(Box(indexFile), forKey: GCDWebServerRequestAttribute_Asset)
       return request
       }) { (request) -> GCDWebServerResponse! in


  fileprivate func addHandlerForLocalFileSystem() {
    localServer.addHandler(match: { (requestMethod, requestURL, requestHeaders, URLPath, URLQuery) -> GCDWebServerRequest! in
      if requestMethod != "GET" { return nil }

      if !(URLPath?.hasPrefix(localFileSystemPath))! { return nil }

      let filePath = URLPath?.substring(from: localFileSystemPath.endIndex)
      let fileURL = URL(fileURLWithPath: filePath!)
      if fileURL.isRegularFile != true { return nil }

      let request = GCDWebServerRequest(method: requestMethod, url: requestURL, headers: requestHeaders, path: URLPath, query: URLQuery)
      request?.setAttribute(filePath, forKey: GCDWebServerRequestAttribute_FilePath)
      return request
      }) { (request) -> GCDWebServerResponse! in


  fileprivate func addHandlerForAssetBundle() {
    localServer.addHandler(match: { [weak self] (requestMethod, requestURL, requestHeaders, URLPath, URLQuery) -> GCDWebServerRequest! in
    localServer.addHandler(match: { [weak self] (requestMethod, requestURL, requestHeaders, urlPath, urlQuery) -> GCDWebServerRequest! in
      if requestMethod != "GET" { return nil }
      guard let urlPath = urlPath else { return nil }
      guard let asset = self?.currentAssetBundle?.assetForURLPath(urlPath) else { return nil }

      let request = GCDWebServerRequest(method: requestMethod, url: requestURL, headers: requestHeaders, path: urlPath, query: urlQuery)!
      request.setAttribute(Box(asset), forKey: GCDWebServerRequestAttribute_Asset)
      return request
    }) { (request) -> GCDWebServerResponse! in
