Fix login and logout