Adding try-catch around OS detection