Fixed a  bug occurring with max slices.