port fix of safari's onpopstate bug