Fixed logout process