Replace only replaces the current history item, it does not clear the entire history stack. There is no API for clearing the entire stack. So if pbStateReplace is true then going back should go back to the history item before the previous item...