fixed search function