Fixup _dims2shape function