fix a bug when keys have not been entered.