improve exception management