bugfix and better history