Added security checks on flags.