fixed bug with search function