fix bug in history management