         if let modifiedUrl = modifyUrl(orig: url) {
             let request = URLRequest(url: modifiedUrl)
             // clear out existing page while we load.
-            webView?.evaluateJavaScript("document.body.remove()")
-            webView?.load(request)
+            webView.evaluateJavaScript("document.body.remove()")
+            webView.load(request)
         }
     }
 


    func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge,
                 completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
        let credential = URLCredential(
            user: Preferences.username,
            password: Preferences.password,
            persistence: .forSession
        )
        completionHandler(.useCredential, credential)
    }

    func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {

        }
    }

    func webView(_ webView: WKWebView,
                 createWebViewWith configuration: WKWebViewConfiguration,
                 for navigationAction: WKNavigationAction,
                 windowFeatures: WKWindowFeatures) -> WKWebView? {
        let schemes = ["http", "https"]
        if navigationAction.targetFrame == nil,
           let url = navigationAction.request.url,
           let scheme = url.scheme,
           schemes.contains(scheme) {
            let svc = SFSafariViewController(url: url)
            present(svc, animated: true, completion: nil)
        }

        return nil
    }

    func loadWebView(force: Bool = false) {
        let authStr = "\(Preferences.username):\(Preferences.password)"
        let newTarget = "\(openHABRootUrl):\(authStr)"
