Improve JID error handling