`$units` is ArrayCollection, `$i` sequence can be 0, 1, 5, 6... This fixes it to remove right number of units.