Adds workaround to remove empty local arrays

Slices the distribution object to remove all empty localarrays before
returning.  Only done if all dimensions use 'b' or 'n' in the dist
tuple.

Generalizes the fix in PRs #444 and #447.