Mod replaceState logic