Improve exception handling a bit

Make it narower, cause try-except block is too wide for some cases
this looks good. the try block could generate an AttributeError which we should not catch.