Fixing login and logout