Backport of https://issues.jboss.org/browse/JBTM-1942