fixed back and forward button behaviour on window popstate event