fix bugs in the server