Fix broken back button using replaceState