fixed bugs for chat