Fixed bugs in server and client