Merge pull request #2706 from ludovic-henry/fix-unhandledexception