Fixed login/logout handlers