         
         guard selectionStyle == .check else { return }
         
-        guard indexPath.item == indexOfSelectedColor else {
+        guard indexPath.item == indexSelectedColor else {
             colorPickerCell.checkbox.setCheckState(.unchecked, animated: false)
             return
         }

                print("ERROR ColorPickerView - preselectedItem out of colors range")
                return
            }
            indexOfSelectedColor = preselectedIndex
            
            collectionView.selectItem(at: IndexPath(item: indexOfSelectedColor!, section: 0), animated: false, scrollPosition: .centeredHorizontally)
        }
    }
    /// If true, the selected color can be deselected by a tap

    open var layoutDelegate: ColorPickerViewDelegateFlowLayout?
    /// The object that acts as the delegate for the color picker
    open var delegate: ColorPickerViewDelegate?
    /// The index of the selected color in the color picker 
    open var indexOfSelectedColor: Int? {
        return indexSelectedColor
    }
    /// The index of the preselected color in the color picker
    open var preselectedIndex: Int? = nil {
        didSet {
