Fixed correct messageId modulo calculation.