reintroduced email variables in invite function to facilitate debugging