fixed various history bugs, mouse handling bugs