fixed generate key bug