Some fixes on login flow