Fixed key generation error