fix all bugs in the server and make all tests pass