corrected appendMessage() method