made it all work
trimmed the test script