add logic to prevent exceptions from being handled twice