added minor fixes to iterating with indexes