Backport of JBWEB-281