fixes coding rule, don't create a closure in a loop