fix bug with exceptions