         }
         
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
-            self.animationView!.alpha = 0
+            if let animationView = self.animationView {
+                animationView.alpha = 0
+            }
             completion?()
         }
         
-        let firstItemView = animationView!.subviews.filter{$0.tag == 0}.first
-        firstItemView!.layer.masksToBounds = false
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64((delay - durations.last! * 1.5) * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
-            firstItemView!.layer.cornerRadius = self.foregroundView.layer.cornerRadius
+        if let animationView = self.animationView {
+            let firstItemView = animationView.subviews.filter{$0.tag == 0}.first
+            firstItemView?.layer.masksToBounds = false
+            if let durationLast = durations.last {
+                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64((delay - durationLast * 1.5) * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
+                    firstItemView?.layer.cornerRadius = self.foregroundView.layer.cornerRadius
+                }
+            }
         }
     }
 }

    }
    
    public func isAnimating()->Bool {
        guard animationItemViews != nil
        else {
            return false
        }
        
        for item in animationItemViews! {
            if item.layer.animationKeys()?.count > 0 {
                return true
            }

        var hidden = true
        configureAnimationItems(.Close)
        for var index = 0; index < animationItemViews?.count; index++ {

            guard let animatedView = animationItemViews?.reverse()[index] else {
                continue
            }
            
            animatedView.foldingAnimation(timing, from: from, to: to, duration: durations[index], delay: delay, hidden: hidden)
            
            to = to == 0.0 ? CGFloat(M_PI / 2) : 0.0;
            from = from == 0.0 ? CGFloat(-M_PI / 2) : 0.0;
