Improved test script so it will work on osx