fixed bugs and changed test.py module accordingly