Fixed search/insert bug

Apex