ThreadKeyGeneratorImpl: tests and slight changes im implementation