Issue 1763

Fixes #1763
(or more accurately it will when it is ok)

Replaces closed pull request #2286.