Fixed OS detection code

Fixed OS detection code bug highlighted in issue #252