Fix key generation, especially for mixed workloads