search function fixed