new method addFlagsByParent