better exception control