Fix for key generation