Ian/ai fixes

Ready for review @nicolashery , it deals with the items in this card https://trello.com/c/zxl9K9wF/118-2-access-and-invitations-bug-fixes