Fixed some login logic