fixing NPE

Incorrect reference to it remained after converting this from a closure to iteration.