fix bugs in test.py