fixing search function