Minor corrections to exception handling

[ci skip]