change location.replace to location.href