Fix loop on authentication