Improved the exception management