apparently this is no 100% correct way to check invidual flags
this is apparently the more correct way
remove dead code, add debugging