fixed login logic issue