porting timhaines fix for meteor.loginwithx bug