Small optimization to avoid double computation of hash in putImpl()