Fix #1003
Replace throwable catch by exception
Merge pull request #1008 from emmanuel-keller/master

Bug fix and improvement