I didn't realize it in the last pull request, but you're unpacking the exmpp_jid record here, which is a no-no. Use the exmpp_jid functions to get the values out, in case future versions of exmpp change the ordering of the record. I think the "prep_{node,domain,resource}" functions should get you the raw values from the record.