fix bugs in test script