             }.resume()
         }
         
-        func del(_ key: String, version: UInt64, completionFunc: @escaping (UInt64, Date, BRRemoteKVStoreError?) -> ()) {
-            let req = NSMutableURLRequest(url: client.url("/kv/1/\(key)"))
+        func del(_ key: String, version: UInt64,
+                 completionFunc: @escaping (UInt64, Date, BRRemoteKVStoreError?) -> ()) {
+            var req = URLRequest(url: client.url("/kv/1/\(key)"))
             req.httpMethod = "DELETE"
             req.addValue("\(version)", forHTTPHeaderField: "If-None-Match")
-            client.dataTaskWithRequest(req as URLRequest, authenticated: true, retryCount: 0) { (dat, resp, err) in
+            client.dataTaskWithRequest(req, authenticated: true, retryCount: 0) { (dat, resp, err) in
                 if let err = err {
                     self.client.log("[KV] DELETE key=\(key) err=\(err)")
                     return completionFunc(0, Date(timeIntervalSince1970: 0), .unknown)

            return handler(NSError(domain: BRAPIClientErrorDomain, code: 500, userInfo: [
                NSLocalizedDescriptionKey: NSLocalizedString("JSON Serialization Error", comment: "")]))
        }
        session.dataTask(with: req as URLRequest, completionHandler: { (data, resp, err) in
            DispatchQueue.main.async {
                if let httpResp = resp as? HTTPURLResponse {
                    // unsuccessful response from the server

    }
    
    func signRequest(_ request: URLRequest) -> URLRequest {
        var mutableRequest = request
        let dateHeader = getHeaderValue("date", d: mutableRequest.allHTTPHeaderFields)
        if dateHeader == nil {
            // add Date header if necessary
            mutableRequest.setValue(Date().RFC1123String(), forHTTPHeaderField: "Date")
