fixed odd bug where loop iterator vars get shadowed, causing weird behaviour