Fixed login/register logic.