Fix for sequence number check, messages aren't inserted in order.

Hence, we can only check after inserting all messages.