Fix mac compile error and makefiles