Merge "Use correct UID checks and proper database lookup" into nyc-mr1-dev