Fix logout and relogin issue