Fixed search functions in search.py