Reverted some previous changes to fix login attempt and reconnect issues

fixes #142
fixes #143