smarter auto-search-typing and better error handling