Fix login handling