fix location replace bug