Fix bugs in history view