- complete port of pull request #34