Fix max(-1) is smaller than min(0) warning