Slicing resulting in empty arrays

These two patches (with tests) ensure that correctly shaped results are returned whenever a slicing operation on a dataset yields an array with a zero in the shape vector.

Fixes #330.

After preparing this, I noticed #329 which seems to address the same problem. I think my patches cover a wider range of cases, but I haven't tested this hypothesis.