fixed bug with repeat index replace