OSX port

Very minor modifications to support running on OSX.