Fixes issues reported in processone/ejabberd-contrib/#22