Fixed some bugs in chat