fix issue with index and repeat