fixing login logic