fix build errors on mac