work around numpy crash with size 0 arrays

here's the numpy issue: https://github.com/numpy/numpy/issues/5195