Roll in fixes to make login handling more reliable.