Test that flattened queries are shifted correctly
Fix problem with shifting flattened data