fixed search to return proper value