Fixed login and logout problems