Fixed login and logout