some fixes and modification for search