Fixed some issues with inserting messages.