fix crash when searching twice