Fixing bug where selected index was not being set when calling _setSelectedIndex