fix a bug of addHistory