fixed iteration counting issue (i was used twice, but shouldn't affect output)