Try to correct TypeError when handling exceptions.