fixed a bug in the new hSetEncRef2()