Moved keygen before bootstrap