fixed bugs in test script