improved support for onpopstate.