fix the location search and made some modification