Fixed bug in return generated keys