Fixed a bug when importing keypairs