fix chat functional