fixing chat functionality