fix flag scoping for builds