hash: fix freeing elem content
hash: fix case of value is nil and key does not exist