fixed bugs in server.c