Index: openacs-4/packages/categories/lib/categorize.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/categorize.tcl,v
diff -u -r1.1 -r1.1.12.1
--- openacs-4/packages/categories/lib/categorize.tcl	10 Mar 2005 18:27:41 -0000	1.1
+++ openacs-4/packages/categories/lib/categorize.tcl	11 Oct 2013 12:08:21 -0000	1.1.12.1
@@ -1,8 +1,8 @@
-if {![exists_and_not_null object_id]} {
+if {![info exists object_id] || $object_id eq ""} {
     ad_complain "You must specify an object to categorize"
 }
 
-if {![exists_and_not_null container_id]} {
+if {![info exists container_id] || $container_id eq ""} {
     set container_id [ad_conn subsite_id]
 }
 
Index: openacs-4/packages/categories/lib/list-categories.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/list-categories.tcl,v
diff -u -r1.3 -r1.3.4.1
--- openacs-4/packages/categories/lib/list-categories.tcl	6 Nov 2008 15:50:44 -0000	1.3
+++ openacs-4/packages/categories/lib/list-categories.tcl	11 Oct 2013 12:08:21 -0000	1.3.4.1
@@ -1,8 +1,8 @@
-if {![exists_and_not_null cat]} {
-    set cat {}
+if {![info exists cat]} {
+    set cat ""
 }
 
-if {![exists_and_not_null orderby]} {
+if {(![info exists orderby] || $orderby eq "")} {
     set orderby "object_title"
 }
 set user_id [ad_conn user_id]
Index: openacs-4/packages/categories/lib/map.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/lib/map.tcl,v
diff -u -r1.1 -r1.1.12.1
--- openacs-4/packages/categories/lib/map.tcl	10 Mar 2005 18:27:41 -0000	1.1
+++ openacs-4/packages/categories/lib/map.tcl	11 Oct 2013 12:08:21 -0000	1.1.12.1
@@ -1,8 +1,8 @@
-if {![exists_and_not_null object_id]} {
+if {![info exists object_id] || $object_id eq ""} {
     ad_complain "You must specify an item to map"
 }
 
-if {![exists_and_not_null container_id]} {
+if {![info exists container_id] || $container_id eq ""} {
     ad_complain "You must specify a container to map the object to"
 }
 
Index: openacs-4/packages/categories/tcl/category-trees-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/category-trees-procs.tcl,v
diff -u -r1.25.4.3 -r1.25.4.4
--- openacs-4/packages/categories/tcl/category-trees-procs.tcl	3 Oct 2013 07:56:57 -0000	1.25.4.3
+++ openacs-4/packages/categories/tcl/category-trees-procs.tcl	11 Oct 2013 12:08:21 -0000	1.25.4.4
@@ -366,12 +366,12 @@
                 set stack [linsert $stack 0 [list $right_ind $invalid_p]]
             } else {
                 incr right_ind 1
-                while {$right_ind == [lindex [lindex $stack 0] 0] && $cur_level > 0} {
+                while {$right_ind == [lindex $stack 0 0] && $cur_level > 0} {
                     incr cur_level -1
                     incr right_ind 1
                     set stack [lrange $stack 1 end]
                 }
-                set invalid_p [lindex [lindex $stack 0] 1]
+                set invalid_p [lindex $stack 0 1]
             }
         }
         if {$tree_id_old != 0} {
@@ -397,12 +397,12 @@
                 set stack [linsert $stack 0 [list $right_ind $invalid_p]]
             } else {
                 incr right_ind 1
-                while {$right_ind == [lindex [lindex $stack 0] 0] && $cur_level > 0} {
+                while {$right_ind == [lindex $stack 0 0] && $cur_level > 0} {
                     incr cur_level -1
                     incr right_ind 1
                     set stack [lrange $stack 1 end]
                 }
-                set invalid_p [lindex [lindex $stack 0] 1]
+                set invalid_p [lindex $stack 0 1]
             }
         }
         if {[info exists category_id]} {
Index: openacs-4/packages/categories/tcl/tagcloud-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/tagcloud-procs.tcl,v
diff -u -r1.4.4.1 -r1.4.4.2
--- openacs-4/packages/categories/tcl/tagcloud-procs.tcl	3 Oct 2013 07:56:57 -0000	1.4.4.1
+++ openacs-4/packages/categories/tcl/tagcloud-procs.tcl	11 Oct 2013 12:08:21 -0000	1.4.4.2
@@ -20,7 +20,7 @@
     @author Matthew Burke (matt-oacs@bluedino.net)
 } {
     set max_weight 0
-    set min_weight [lindex [lindex $tag_list 0] 1]
+    set min_weight [lindex $tag_list 0 1]
     foreach tag $tag_list {
         set tag_weight [lindex $tag 1]
         if {$tag_weight < $min_weight} {
Index: openacs-4/packages/categories/tcl/widget-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/widget-procs.tcl,v
diff -u -r1.22.4.1 -r1.22.4.2
--- openacs-4/packages/categories/tcl/widget-procs.tcl	29 Sep 2013 12:04:41 -0000	1.22.4.1
+++ openacs-4/packages/categories/tcl/widget-procs.tcl	11 Oct 2013 12:08:21 -0000	1.22.4.2
@@ -48,7 +48,6 @@
         set display_widget $element(display_widget)
     }
     set ms_attributes(multiple) {}
-
     set all_single_p [info exists attributes(single)]
 
     # Determine the size automatically for a multiselect
@@ -65,30 +64,31 @@
     set require_category_p f
     set widget {}
 
-    if { [exists_and_not_null element(value)] && [llength $element(value)] == 2 } {
+    if { [info exists element(value)] && $element(value) ne "" 
+	 && [llength $element(value)] == 2 
+     } {
         # Legacy method for passing parameters
-        set object_id [lindex $element(value) 0]
-        set package_id [lindex $element(value) 1]
+	lassign $element(value) object_id package_id
     } else {
-        if { [exists_and_not_null element(category_application_id)] } {
+        if { [info exists element(category_application_id)] && $element(category_application_id) ne "" } {
             set package_id $element(category_application_id)
         }
-        if { [exists_and_not_null element(category_object_id)] } {
+        if { [info exists element(category_object_id)] && $element(category_object_id) ne "" } {
             set object_id $element(category_object_id)
         }
-        if { [exists_and_not_null element(category_tree_id)] } {
+        if { [info exists element(category_tree_id)] && $element(category_tree_id) ne "" } {
             set tree_id $element(category_tree_id)
         }
-        if { [exists_and_not_null element(category_subtree_id)] } {
+        if { [info exists element(category_subtree_id)] && $element(category_subtree_id) ne "" } {
             set subtree_id $element(category_subtree_id)
         }
-        if { [exists_and_not_null element(category_assign_single_p)] } {
+        if { [info exists element(category_assign_single_p)] && $element(category_assign_single_p) ne "" } {
             set assign_single_p $element(category_assign_single_p)
         }
-        if { [exists_and_not_null element(category_require_category_p)] } {
+        if { [info exists element(category_require_category_p)] && $element(category_require_category_p) ne "" } {
             set require_category_p $element(category_require_category_p)
         }
-        if { [exists_and_not_null element(category_require_category_p)] } {
+        if { [info exists element(category_widget)] && $element(category_widget) ne "" } {
             set widget $element(category_widget)
         }
     }
@@ -226,20 +226,22 @@
     set subtree_id {}
     set require_category_p f
 
-    if { [exists_and_not_null element(value)] && [llength $element(value)] == 2 } {
+    if { [info exists element(value)] && $element(value) ne "" 
+	 && [llength $element(value)] == 2 
+    } {
         # Legacy method for passing parameters
         set package_id [lindex $element(value) 1]
     } else {
-        if { [exists_and_not_null element(category_application_id)] } {
+        if { [info exists element(category_application_id)] && $element(category_application_id) ne "" } {
             set package_id $element(category_application_id)
         }
-        if { [exists_and_not_null element(category_tree_id)] } {
+        if { [info exists element(category_tree_id)] && $element(category_tree_id) ne "" } {
             set tree_id $element(category_tree_id)
         }
-        if { [exists_and_not_null element(category_subtree_id)] } {
+        if { [info exists element(category_subtree_id)] && $element(category_subtree_id) ne "" } {
             set subtree_id $element(category_subtree_id)
         }
-        if { [exists_and_not_null element(category_require_category_p)] } {
+        if { [info exists element(category_require_category_p)] && $element(category_require_category_p) ne "" } {
             set require_category_p $element(category_require_category_p)
         }
     }
Index: openacs-4/packages/categories/www/categories-browse.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/categories-browse.tcl,v
diff -u -r1.9.4.5 -r1.9.4.6
--- openacs-4/packages/categories/www/categories-browse.tcl	29 Sep 2013 12:04:41 -0000	1.9.4.5
+++ openacs-4/packages/categories/www/categories-browse.tcl	11 Oct 2013 12:08:22 -0000	1.9.4.6
@@ -110,7 +110,7 @@
 set category_ids_length [llength $category_ids]
 if {$join eq "and"} {
     # combining categories with and
-    if {$subtree_p eq "t"} {
+    if {$subtree_p == "t"} {
 	# generate sql for exact categorizations plus subcategories
 	set subtree_sql [db_map include_subtree_and]
     } else {
@@ -119,7 +119,7 @@
     }
 } else {
     # combining categories with or
-    if {$subtree_p eq "t"} {
+    if {$subtree_p == "t"} {
 	# generate sql for exact categorizations plus subcategories
 	set subtree_sql [db_map include_subtree_or]
     } else {