fix in search algoritm