Fixed a few issues when targeting OS X.