improved os detection