Fixed bug in wallet creation and restore.