Added autoRetryLogin and fixed failed login detection.