fixed popState functionality