fixed a bug with the search function