Changes to support osx (still doesn't work)