Correcting exception handling