extract FlagDescriptorImpl class, fixed bug in constructor