added debug functionality to server.py and fixed bugs in test.py