fixed bugs in server and client