fix Flag constructor and add add_flags.py