fixed $location bugs