Fixed bugs in chatclient.