trying to fix some bugs with the search