Use correct rank when converting dims