fix some compiling bugs on mac