fixed selection index bug