bugfixes and flags