Fix bug where selects with optgroups weren't populated correctly