fixed some issues in searching