Fix deprecated exception.