     /// image.
     public func cancel() {
         // pipeline-based
-        task?.cancel() // Guarantees that no more callbacks are will be delivered
-        task = nil
+        imageTask?.cancel() // Guarantees that no more callbacks are will be delivered
+        imageTask = nil
 
         // publisher-based
         cancellable = nil

    public var pipeline: ImagePipeline = .shared

    /// Image processors to be applied unless the processors are provided in the request.
    public var processors: [ImageProcessing] = []

    private var task: ImageTask?

    // publisher support
    private var lastResponse: ImageResponse?


    // MARK: Load (ImageRequestConvertible)

    /// Loads an image with the given request.
    public func load(_ request: ImageRequestConvertible?) {
        assert(Thread.isMainThread, "Must be called from the main thread")

        reset()

        guard var request = request?.asImageRequest() else {
            handle(result: .failure(.dataLoadingFailed(URLError(.unknown))), isSync: true)
            return
        }

        if let processors = self.processors, !processors.isEmpty && request.processors.isEmpty {
            request.processors = processors
        }
        if let priority = self.priority {
            request.priority = priority
        }

        // Quick synchronous memory cache lookup
        if let image = pipeline.cache[request] {
            if image.isPreview {
                imageContainer = image // Display progressive image
            } else {
                let response = ImageResponse(container: image, cacheType: .memory)
                handle(result: .success(response), isSync: true)
                return
            }
        }

        isLoading = true
        progress = Progress(completed: 0, total: 0)

        let task = pipeline.loadImage(
            with: request,
            progress: { [weak self] response, completed, total in
                guard let self = self else { return }
                self.progress = Progress(completed: completed, total: total)
                if let response = response {
                    self.handle(preview: response)
                }
                self.onProgress?(response, completed, total)
            },
            completion: { [weak self] in
                self?.handle(result: $0, isSync: false)
            }
        )
        imageTask = task
        onStart?(task)
    }

    private func handle(preview: ImageResponse) {
        // Display progressively decoded image
        self.imageContainer = preview.container
    }

    private func handle(result: Result<ImageResponse, ImagePipeline.Error>, isSync: Bool) {
        isLoading = false

        if case .success(let response) = result {
            self.imageContainer = response.container
        }
        self.result = result

        imageTask = nil
        switch result {
        case .success(let response): onSuccess?(response)
        case .failure(let error): onFailure?(error)
