Fix some login bugs