Fixed login logic