Fix os detection

See #4283
Fix os detection

See #3373
Land #4292, remove os_flavor usage.