Improved work with exceptions.