fix bugs in server.py