make login process more robust