implement Hash#replace