osx fixes

This just gets the OSX code up to date with Linux.