Backport #3033 to 0.13.x

Backport ndimage.label bugfix #3033 for maintenance/0.13.x