Fix #1217
Implements #266
Remove debug info #266
Merge pull request #1222 from emmanuel-keller/master

Bug fix and improvement