Fix handling of URL fragments

Was not going to target if the fragment was already in the
window.location. Also was calling the  hashChangeHandler too early
before the pages had been calculated.