Implements #1139
Merge pull request #1142 from emmanuel-keller/master

Implements #1139