Fix bug: Rewrite logic for detecting OS_VERSION