Correcting User ID in foreach upsert check