hash: fix case where value is nil and key does not exist