Fix a bug where calling pushState or replaceState before the dom had been rendered would throw an error.  Fixes #47.