fixed bugs, polished login/logout