fixed some bugs in chat