history count bugfix