Login/logout fixes