Fix weird search logic