Strange UICollectionViewFlowLayout behavior

I have a UICollectionView where i show items like in the image below, using sizeForItemAtIndexPath delegate method. Sometimes there's a custom cell with full width and there could be other items below it.

enter image description here

Everything works like a charm but i have an issue when the number of items before full width cell is not a multiple of 3.

For example, i'd like to have this result:

enter image description here

But in this situation the output is this:

enter image description here

Seems like a custom UICollectionViewFlowLayout behavior but i want to keep always my items aligned to the left. The same happens in other situations, and when i have only one small item the a row above full width row, the item is centered.

I tried to subclass UICollectionViewFlowLayout and put some logic inside its methods but i can't see my expected result.

open override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
    let attributes = super.layoutAttributesForElements(in: rect)
    if attributes != nil {

        for attribute in attributes! {

            // skip comparison with non cell items (headers and footers)
            if attribute.representedElementCategory != .cell {
                break
            }

            // don't know what is the condition to make some frame changes..
            attribute.frame.origin.x = sectionInset.left
        }
    }

    return attributes
}

Hope I explained myself, Thanks.