fixed to work on OSX