fix a bug about generate session key