fixed a bug in the search