Made AuthenticationHelper more robust.