OSX fix from https://github.com/bitcoin/bitcoin/commit/fee10d800e2599962f2960ddf27963c2f3768bd0