- complete backport from 1.8 of pull request #15