diff --git a/src/jamidht/conversation.cpp b/src/jamidht/conversation.cpp
index abe48fb00e73ba381f9ee70341ed08d8203d35da..7ced8ff1a8ab9e33849ff042c83a285466db03ec 100644
--- a/src/jamidht/conversation.cpp
+++ b/src/jamidht/conversation.cpp
@@ -996,7 +996,7 @@ Conversation::Impl::handleMessage(History& history, const std::shared_ptr<libjam
         // For a loaded message, we load from newest to oldest
         // So we change the parent of the last message.
         if (!history.messageList.empty())
-            (*history.messageList.rbegin())->linearizedParent = sharedCommit->id;
+            sharedCommit->linearizedParent = (*history.messageList.rbegin())->id;
         history.messageList.emplace_back(sharedCommit);
     }
     // Handle pending reactions/editions