restored exception handling