Fixes the issue with select/each

Fixes #9436
@rwjblue most certainly