Fix duplicate increment of message index