fix bug in searching