Fix a bug with search, and fix the API.