     public func invalidateAndCancel() {
         self.performBlock {
             self.imageLoader.delegate = nil
-            self.cancelTasks(Array(self.executingTasks))
+            self.cancelTasks(self.executingTasks)
             self.preheatingTasks.removeAll()
             self.configuration.dataLoader.invalidate()
             self.invalidated = true

    private var executingTasks = Set<ImageTaskInternal>()
    private var preheatingTasks = [ImageRequestKey: ImageTaskInternal]()
    private let lock = NSRecursiveLock()
    private var preheatingTaskCounter = 0
    private var invalidated = false
    private var needsToExecutePreheatingTasks = false
    
    public init(configuration: ImageManagerConfiguration) {

        self.performBlock {
            self.cancelTasks(requests.flatMap {
                return self.preheatingTasks[self.imageLoader.preheatingKeyForRequest($0)]
            })
        }
    }
    
    public func stopPreheatingImages() {
        self.performBlock {
            self.cancelTasks(self.preheatingTasks.values)
        }
    }
    
