Fix bug relating to history lookup.