Set random seed in tests.
Add better garbage collection of in-flight keys.