Fix bug when create publickey