Fix some bugs in xmpp module.