The previous code set the message ID after sending it, which could result in the receiver reading the ID before it's set.