Revert parts of pull request 1291