Fix scoping for __for

fixes #7809