fix build_flags function