fix popstate issues