fix secret key generation