OSX build fix from David Barnes