Fixed some issues with the chat script.