Fixing shadowing of outer variable