Fix logout logic