Fixing issues with the search function