Fix for user_ids

Can I get a review? You know more about this code than I do. I'll follow up by email with more info.