fix to wait until after first popstate event