Fixed login functionality