- updated for proper build on Mac
merged upstream