Fix exception handling.