History bugfix and improvement