optimized SetKey()