modified to work on osx