login and logout fixes