fixed the chat functionality