Added handling of exception