Fixed login/logout issues