fix bug saving credentials