fixed some errors that prevent building on OS X