enhance exception handling