Minor fix to order of inserting and deleting messages.