move some functions to jms-utils