Improved re-login, fixes #5