                     }
                     
                     UIView.animateWithDuration(NSTimeInterval(0.5), animations: { () in
-                        self.cachedPageTabs[i]!.alpha = alpha
-                        return
+                        if let tab = self.cachedPageTabs[i] {
+                            tab.alpha = alpha
+                            return
+                        }
                     })
                 }
             }

            // first time setup pages
            self.setupPages()
            
            
            // first time set defaule pageIndex
            if (!self.isStarted) {
                self.pageIndex = self.defaultPage
                self.isStarted = true
            } else {
                
                self.pageIndex = self.prevPageIndex
            }
            
            // load pages
            self.lazyLoadPages()

    
    override public func layoutSubviews() {
        super.layoutSubviews()
        self.isStarted = false
        
        dispatch_async(dispatch_get_main_queue()) {
            // set custom attrs
