Backport of https://issues.jboss.org/browse/AS7-5021