Some fixes for compilation on the mac