Some fixes for building on mac