osx-compatible ostype command and other portability modifications