                 let delegate = object as? XWalkDelegate
                 if delegate?.invokeNativeMethod != nil {
                     let selector = Selector("invokeNativeMethod:arguments:")
-                    Invocation.call(object, selector: selector, arguments: [method, args], thread: _thread)
+                    Invocation.call(object, selector: selector, arguments: [method, args], thread: thread)
                 } else if mirror.hasMethod(method) {
-                    Invocation.call(object, selector: mirror.getMethod(method), arguments: args, thread: _thread)
+                    Invocation.call(object, selector: mirror.getMethod(method), arguments: args, thread: thread)
                 } else {
                     println("ERROR: Method '\(method)' is not defined in class '\(object.dynamicType.description())'.")
                 }

    public func evaluateJavaScript(string: String, completionHandler: ((AnyObject!, NSError!)->Void)?) {
        // TODO: Should call completionHandler with an NSError object when webView is nil
        if NSThread.isMainThread() {
            _webView.evaluateJavaScript(string, completionHandler: completionHandler)
        } else {
            dispatch_async(dispatch_get_main_queue()) {
                self._webView.evaluateJavaScript(string, completionHandler: completionHandler)
            }
        }
    }

            (object as? XWalkDelegate)?.didUnbindExtension?()
        } else if body["destroy"] != nil {
            // Destroy extension
            if webView.URL != nil {
                evaluateJavaScript("delete \(namespace);", completionHandler:nil)
            }
            webView.configuration.userContentController.removeScriptMessageHandlerForName("\(name)")
            if userScript != nil {
                webView.configuration.userContentController.removeUserScript(userScript!)
            }
            for (_, object) in instances {
                (object as? XWalkDelegate)?.didUnbindExtension?()
