fix history bugs.