fixed to bag end index calculation for orgranizeBag.