Fix index in loop.