diff --git a/src/core/statistics/hash_table.c b/src/core/statistics/hash_table.c
index f0105ee6830bc443f7609b2d1b64d824fc050c68..1aee86d3a45e17bbf23d77f72195c0be47680974 100644
--- a/src/core/statistics/hash_table.c
+++ b/src/core/statistics/hash_table.c
@@ -141,10 +141,10 @@ static gpr_int32 find_bucket_idx(const census_ht* ht, census_ht_key key) {
 
 static int keys_match(const census_ht_option* opt, const ht_entry* p,
                       const census_ht_key key) {
+  GPR_ASSERT(opt->key_type == CENSUS_HT_UINT64 ||
+             opt->key_type == CENSUS_HT_POINTER);
   if (opt->key_type == CENSUS_HT_UINT64) return p->key.val == key.val;
-  if (opt->key_type == CENSUS_HT_POINTER)
-    return !opt->compare_keys((p->key).ptr, key.ptr);
-  return 0;
+  return !opt->compare_keys((p->key).ptr, key.ptr);
 }
 
 static entry_locator ht_find(const census_ht* ht, census_ht_key key) {
diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c
index fb75de520e8096a15bfcc103bd12024aa986701e..8c7682419352b33914be142e06760c5552facbad 100644
--- a/test/core/statistics/hash_table_test.c
+++ b/test/core/statistics/hash_table_test.c
@@ -123,7 +123,8 @@ static void test_value_and_key_deleter() {
                           &free_data, &free_data};
   census_ht* ht = census_ht_create(&opt);
   census_ht_key key;
-  char* val;
+  char* val = NULL;
+  char* val2 = NULL;
   key.ptr = gpr_malloc(100);
   val = gpr_malloc(10);
   strcpy(val, "value");
@@ -132,6 +133,17 @@ static void test_value_and_key_deleter() {
   GPR_ASSERT(census_ht_get_size(ht) == 0);
   census_ht_insert(ht, key, val);
   GPR_ASSERT(census_ht_get_size(ht) == 1);
+  val = census_ht_find(ht, key);
+  GPR_ASSERT(val != NULL);
+  GPR_ASSERT(strcmp(val, "value") == 0);
+  /* Insert same key different value, old value is overwritten. */
+  val2 = gpr_malloc(10);
+  strcpy(val2, "v2");
+  census_ht_insert(ht, key, val2);
+  GPR_ASSERT(census_ht_get_size(ht) == 1);
+  val2 = census_ht_find(ht, key);
+  GPR_ASSERT(val2 != NULL);
+  GPR_ASSERT(strcmp(val2, "v2") == 0);
   census_ht_destroy(ht);
 }