safer retry logic
be safer by explicitly casting to (char *) before using pointer arithmetic
make a copy of the key (instead of using a weak reference)

and use an internal buffer if the key is small enough (instead of allocating new memory for the copy)