fix login logic