Index: openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl,v
diff -u -r1.18.2.7 -r1.18.2.8
--- openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl	28 Dec 2021 10:34:45 -0000	1.18.2.7
+++ openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl	28 Dec 2021 16:53:05 -0000	1.18.2.8
@@ -226,8 +226,8 @@
                 # and message and replace them with the value of that
                 # column as returned by the query
                 set pairs [list]
-                for {set i 0} {$i < [ns_set size $recipient]} {incr i} {
-                    lappend pairs "\{[ns_set key $recipient $i]\}" "[ns_set value $recipient $i]"
+                foreach {key value} [ns_set array $recipient] {
+                    lappend pairs "\{$key\}" $value
                 }
 
                 # it's possible that someone may want to override the from
Index: openacs-4/packages/calendar/www/view-list-display.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-list-display.tcl,v
diff -u -r1.41.2.3 -r1.41.2.4
--- openacs-4/packages/calendar/www/view-list-display.tcl	11 Mar 2021 10:48:35 -0000	1.41.2.3
+++ openacs-4/packages/calendar/www/view-list-display.tcl	28 Dec 2021 16:54:55 -0000	1.41.2.4
@@ -227,8 +227,7 @@
 set excluded_vars {}
 set the_form [ns_getform]
 if { $the_form ne "" } {
-    for { set i 0 } { $i < [ns_set size $the_form] } { incr i } {
-        set varname [ns_set key $the_form $i]
+    foreach varname [ns_set keys $the_form] {
         if {$varname eq "period_days" ||
             [string match "__*" $varname] ||
             [string match "form:*" $varname]} {
Index: openacs-4/packages/evaluation/tcl/evaluation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs.tcl,v
diff -u -r1.49.2.5 -r1.49.2.6
--- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl	2 Sep 2021 16:40:55 -0000	1.49.2.5
+++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl	28 Dec 2021 16:56:25 -0000	1.49.2.6
@@ -61,10 +61,7 @@
     }
 
     if { $tag_attributes ne "" } {
-        for {set i 0} { $i < [ns_set size $tag_attributes] } { incr i } {
-            set attribute_name [ns_set key $tag_attributes $i]
-            set attribute_value [ns_set value $tag_attributes $i]
-
+        foreach {attribute_name attribute_value} [ns_set array $tag_attributes] {
             if {$attribute_name eq {}} {
                 append output " $attribute_name"
             } else {
Index: openacs-4/packages/oacs-dav/tcl/tDAV-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/oacs-dav/tcl/tDAV-procs.tcl,v
diff -u -r1.19.2.3 -r1.19.2.4
--- openacs-4/packages/oacs-dav/tcl/tDAV-procs.tcl	23 Oct 2019 07:49:44 -0000	1.19.2.3
+++ openacs-4/packages/oacs-dav/tcl/tDAV-procs.tcl	28 Dec 2021 16:58:27 -0000	1.19.2.4
@@ -1637,8 +1637,8 @@
 
     set tdav_shares [ns_configsection "ns/server/[ns_info server]/tdav/shares"]
     if { "" ne $tdav_shares } {
-        for {set i 0} {$i < [ns_set size $tdav_shares]} {incr i} {
-            set tdav_share [ns_configsection "ns/server/[ns_info server]/tdav/share/[ns_set key $tdav_shares $i]"]
+        foreach s [ns_set keys $tdav_shares] {
+            set tdav_share [ns_configsection "ns/server/[ns_info server]/tdav/share/$s"]
             tdav::apply_filters [ns_set get $tdav_share uri] [ns_set get $tdav_share options] [ns_set get $tdav_share enablefilesystem]
             # uncomment the next line if you are using ns_perm authentication
             # tdav::allow_group [ns_set get $tdav_share uri] tdav