     private var context: JSContext!
     private var values: [String: JSValue] = [:]
     private var cleanups: [() -> Void] = []
-    private weak var delegate: WukongDelegate!
+    private weak var delegate: WukongDelegate?
 
     private var client: JSValue { return context.globalObject.forProperty(Constant.Script.client).forProperty(Constant.Script.main) }
     private var action: JSValue { return context.globalObject.forProperty(Constant.Script.client).forProperty(Constant.Script.action) }

    private func setupContext(_ version: String?, _ script: String?) {
        guard let script = script else {
            print("Client:", "failed", version ?? "n/a")
            delegate.wukongDidFailLoadScript()
            return
        }
        print("Client:", "loaded", version ?? "n/a")
        delegate.wukongDidLoadScript()
        cleanups.forEach { $0() }
        cleanups.removeAll()
        values.removeAll()

            context?.exception = exception
            if let exception = exception?.toString() {
                print("Client:", "exception", exception)
                self.delegate?.wukongDidThrowException(exception)
            }
        }
        context.evaluateScript(script)
