Added ejabberd support, and fixed a few small bugs