fix some build errors when using Mac OSX and gmake / Makefile