fixed bugs on $history