properly handler login state