Fix a bug on connect with login