add select search and fix indexing error