Fixed folding loop bounds and some corner cases regarding zero stride dimensions.