fix keygen bug