Improved the way some errors are handled.