Fixed error message when there are 0 messages in chat, and prevented unsafe data from being inserted into the DOM.