enhance exception checking