Fix logic errors in getMessagesBeforeMessage().