Fixed the addUser function to prevent the possibility of bad input server-side. Also added the externalType field since that was missing from the query