fix a few build errors on OS X