fixed search location function