Fix exception handling bug.