Fix logout error handling.