Use HASH_REPLACE_PTR to ensure safety