         self.sectionInset = UIEdgeInsets.zero
         self.itemRenderDirection =
             CHTCollectionViewWaterfallLayoutItemRenderDirection.chtCollectionViewWaterfallLayoutItemRenderDirectionShortestFirst
-        
-        headersAttributes = NSMutableDictionary()
-        footersAttributes = NSMutableDictionary()
 
         super.init(coder: aDecoder)
     }

            if heightHeader > 0 {
                attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: CHTCollectionElementKindSectionHeader, with: IndexPath(row: 0, section: section))
                attributes.frame = CGRect(x: 0, y: top, width: self.collectionView!.bounds.size.width, height: heightHeader)
                self.headersAttributes.setObject(attributes, forKey: (section as NSCopying))
                self.allItemAttributes.append(attributes)
                
                top = attributes.frame.maxY

    override func layoutAttributesForSupplementaryView(ofKind elementKind: String, at indexPath: IndexPath) -> UICollectionViewLayoutAttributes{
        var attribute = UICollectionViewLayoutAttributes()
        if elementKind == CHTCollectionElementKindSectionHeader{
            attribute = self.headersAttributes[indexPath.section]
        }else if elementKind == CHTCollectionElementKindSectionFooter{
            attribute = self.footersAttributes[indexPath.section]
        }
        return attribute
    }
