Improved OS detection, POSIX compliance