Bug fix

fix for selecting index by value to work with optgroup

TODO: cleanup and rewrite selectIndex to work with optgroup