Fixed search logic