fix chat functionality