Fixed incorrect reference to the raw ndims, even when original ndims is
needed.