fix catching exceptions