OS X build fixes
Tweak OS X compilation
Merge pull request #658 from eile/master

OS X build fixes