Fixed logout flow