Fix bug in join and in getUser

getUser was using a global by mistake - hence race conditions, you
could get the result for the wrong user!