Fix misc bugs in History implementation