Fix check when computing maximum number of rows needed for Limit.