searching logic fixes