Some fixes for programmatically generated flag events not polluting session flag history.