Fix potential issues with test script