Fix some login/out problems