                     }
                 }
                 else if result == .Succeeded {
-                    CGImageDestinationAddImage(destination, image, frameProperties as CFDictionaryRef)
+                    CGImageDestinationAddImage(destination, image!, frameProperties as CFDictionaryRef)
                     
                     generatedImageCount += 1.0
 
                     let progress =  generatedImageCount / Double(timePoints.count)
-                    progressHandler?(image, progress)
+                    progressHandler?(image!, progress)
                     
                     if (CMTimeCompare(requestedTime, timePoints.last!) == 0) {
                         if CGImageDestinationFinalize(destination) {

    /**
    Ascynchronously convert the video at the given URL to a GIF, and return the GIF's URL if it was created.
    
    :param: URL The URL at which the video to be converted to GIF exists
    :param: frameCount Number of frames to extract from the video for use in the GIF. The frames are evenly spaced out and all have the same duration
    :param: delayTime The amount of time for each frame in the GIF.
    :param: loopCount The number of times the GIF will repeat. Defaults to 0, which means repeat infinitely.
    :param: progressHandler The closure to be called with the progress of the conversion. It is called with an argument from 0.0 -> 1.0
    :param: completionHandler The closure to be called on completion of the process. If the conversion was successful, an NSURL to the location of the GIF on disk is passed in.
    */
    public class func createGIFAsynchronouslyFromURL(URL: NSURL, withFrameCount frameCount: Int, delayTime: Float, loopCount: Int = 0, progressHandler: ProgressCallback?, completionHandler: (NSURL? -> Void)?) {
        let fileProperties = [

    /**
    Convert the video at the given URL to a GIF, and return the GIF's URL if it was created.
    
    - parameter URL: The URL at which the video to be converted to GIF exists
    - parameter frameCount: Number of frames to extract from the video for use in the GIF. The frames are evenly spaced out and all have the same duration
    - parameter delayTime: The amount of time for each frame in the GIF.
    - parameter loopCount: The number of times the GIF will repeat. Defaults to 0, which means repeat infinitely.
    */
    public class func createGIFFromURL(URL: NSURL, withFrameCount frameCount: Int, delayTime: Float, loopCount: Int = 0) -> NSURL? {
        var gifURL: NSURL? = nil
