Fixed bug when adding messages