Fix various Mac build issues