Fixed a search logic error