fix to search function to make it one way