fixed a bug in history module.
modified some functions.