Improve HAL detection robustness for OS version.