flag manager debug and bugfixes