login and synchronize fix

This fix solves two problems:
- Authentication denied with TLS based authentication
- Empty synchronize that terminated the session.