improve exception catch