better login handling