This fixes a bug that the last message was sent incorrectly when a session key received for example from the key backup. It may fix several issues like the last message is set as a very old one or the last message is not decrypted.