Github-Pull: #4678 Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
fixes #4630 Github-Pull: #4633