Fix update method to not apply undefined pendingState

Previous to this commit calling update immediatly after loading
the page with an intial hash would cause the initial state to be
overwritten by the empty pending state. I fixed this by leaving
pending state undefined and only applying it when calling update
only if there has been a change.

Alternative solution to #2