Fix logout behavior.