allow c++ optimisations on the hash key
look by object address as well as by reference
do not try to free reference variants
fix lua test