Fixes for building on MacOS