fix id selection issue

Fixes #1041