 
             let total = response.expectedContentLength != NSURLSessionTransferSizeUnknown ? response.expectedContentLength : nil
             httpTask.download.totalBytes = total
-            httpTask.download.callback?(httpTask.download.bytes, httpTask.download.totalBytes)
+            let bytes = httpTask.download.bytes
+            responseQueue.async {
+                httpTask.download.callback?(bytes, total)
+            }
             completionHandler(.allow)
         }
 

            guard let httpTask = tasks.first(where: { $0.task === dataTask }) else { return }

            httpTask.data.append(data)
            httpTask.download.bytes = Int64(httpTask.data.count)
            httpTask.download.callback?(httpTask.download.bytes, httpTask.download.totalBytes)
        }

        func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {

        var trustPolicies: [String: ServerTrustPolicy] = [:]
        private var tasks: [Task] = []
        private let queue: OperationQueue
        private let responseQueue: DispatchQueue

        init(queue: OperationQueue, responseQueue: DispatchQueue) {
            self.queue = queue
            self.responseQueue = responseQueue
        }

        func add(task: Task) {
