htable: fix crash if key_value is not string
(cherry picked from commit 065439c0fbabe2806fcd615cec5e2445db59beec)