Bug fixes, fixes for history issues on window.popState