Overload ndims. Fixes #166