Fix test script to be more portable