added popstate control