Apply pull request 1318