Fixed the double message

When messageBefore or messageAfter were 0, there were double messages
and some would be skipped.