fix bugs in histor