Fix bug with each with index loop.