Fix problem with shifting flattened data