fixed bug in search()