Add compatibility code for OSX.
8 files changed