Fix namespace replacement on popstate