diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp
index 944a59c5224e6b3680210dbed1c2ab35a4c8d048..39f417ebb36dc8f736d7768b17aa6de8f839875c 100644
--- a/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp
+++ b/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp
@@ -85,7 +85,7 @@ int TrieMap::getNextLevelBitmapEntryIndex(const int key, const int bitmapEntryIn
     if (!writeEntry(EMPTY_BITMAP_ENTRY, valueEntryIndex + 1)) {
         return INVALID_INDEX;
     }
-    if (!writeField1(valueEntryIndex | TERMINAL_LINK_FLAG, valueEntryIndex)) {
+    if (!writeField1(valueEntryIndex | TERMINAL_LINK_FLAG, terminalEntryIndex)) {
         return INVALID_INDEX;
     }
     return valueEntryIndex + 1;
diff --git a/native/jni/tests/suggest/policyimpl/dictionary/utils/trie_map_test.cpp b/native/jni/tests/suggest/policyimpl/dictionary/utils/trie_map_test.cpp
index 9904a3aa8ad489f4fa96410e523813735cdd3933..56b5aa985ecb1b19f9dffcd5186f8a14bc9f1311 100644
--- a/native/jni/tests/suggest/policyimpl/dictionary/utils/trie_map_test.cpp
+++ b/native/jni/tests/suggest/policyimpl/dictionary/utils/trie_map_test.cpp
@@ -40,6 +40,7 @@ TEST(TrieMapTest, TestSetAndGet) {
     trieMap.putRoot(11, 1000);
     EXPECT_EQ(1000ull, trieMap.getRoot(11).mValue);
     const int next = trieMap.getNextLevelBitmapEntryIndex(10);
+    EXPECT_EQ(1000ull, trieMap.getRoot(10).mValue);
     trieMap.put(9, 9, next);
     EXPECT_EQ(9ull, trieMap.get(9, next).mValue);
     EXPECT_FALSE(trieMap.get(11, next).mIsValid);