[api] avoid adding same flag multiple times here