use min instead of max for diffing