Fix build on MacOS X

Fix build on MacOS X (almost).