htable: safety check for key type and value

- reported by FS#486