fixed exception handling in example