Mac build fix

Fixes for build on OSX Mountain Lion.