Fixed deadlock with messageToHtml