Added ifdefs so fix for OSX doesn't break Ubuntu