Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-4.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-4.tcl,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-4.tcl	20 Jan 2018 22:44:04 -0000	1.13
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-return-4.tcl	21 Jan 2018 00:37:17 -0000	1.14
@@ -468,7 +468,7 @@
 	      to be reinstated was larger than the original amount used.  This shouldn't have happened unless there was a programming error
 	      or unless the database was incorrectly updated manually.</p>
 	    <p>This transaction has been aborted, i.e. no refund has been given to the customer. This has been logged in the problems log.</p>"
-	return
+	ad_script_abort
     }
 
     # Go through and reinstate certificates in order; it's not so bad
Index: openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-void-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-void-2.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-void-2.tcl	3 Aug 2005 22:45:46 -0000	1.1
+++ openacs-4/packages/dotlrn-ecommerce/www/admin/ecommerce/items-void-2.tcl	21 Jan 2018 00:37:17 -0000	1.2
@@ -107,11 +107,12 @@
 		(problem_id, problem_date, problem_details, order_id)
 		values
 		(ec_problem_id_sequence.nextval, sysdate, 'We were unable to reinstate the customer''s gift certificate balance because the amount to be reinstated was larger than the original amount used.  This shouldn''t have happened unless there was a programming error or unless the database was incorrectly updated manually.  The voiding of this order has been aborted.', :order_id)"
+
 	    ad_return_error "Gift Certificate Error" "
 		<p>We were unable to reinstate the customer's gift certificate balance because the amount to be reinstated was larger than the original amount used.  
 		  This shouldn't have happened unless there was a programming error or unless the database was incorrectly updated manually.</p>
 		<p>The voiding of this order has been aborted.  This has been logged in the problems log.</p>"
-	    return
+	    ad_script_abort
 	} else {
 
 	    # Go through and reinstate certificates in order; it's not
Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl,v
diff -u -r1.22 -r1.23
--- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl	6 Sep 2005 08:53:35 -0000	1.22
+++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/checkout-one-form.tcl	21 Jan 2018 00:37:17 -0000	1.23
@@ -55,8 +55,8 @@
 
 	set register_url "login?return_url=[ns_urlencode $secure_url]&http_id=$user_id&user_session_id=$user_session_id"
 	ad_returnredirect $register_url
-	ad_script_abort
     }
+    ad_script_abort
 }
 
 source [acs_root_dir]/packages/dotlrn-ecommerce/www/ecommerce/check-shopping-cart.tcl
Index: openacs-4/packages/dotlrn-ecommerce/www/ecommerce/finalize-order.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/ecommerce/finalize-order.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/dotlrn-ecommerce/www/ecommerce/finalize-order.tcl	6 Sep 2005 08:53:35 -0000	1.12
+++ openacs-4/packages/dotlrn-ecommerce/www/ecommerce/finalize-order.tcl	21 Jan 2018 00:37:17 -0000	1.13
@@ -460,6 +460,7 @@
 		    ad_return_error "Sorry" "
 			<p>There has been an error in the processing of your credit card information.
 			   Please contact <a href=\"mailto:[ec_system_owner]\">[ec_system_owner]</a> to report the error.</p>"
+		    ad_script_abort
 		}
 	    } else {
 
@@ -600,6 +601,7 @@
 			ad_return_error "Sorry" "
 			    <p>There has been an error in the processing of your credit card information.
 			       Please contact <a href=\"mailto:[ec_system_owner]\">[ec_system_owner]</a> to report the error.</p>"
+			ad_script_abort
 		    }
 		} elseif { [string equal $result "failed_authorization"] || [string equal $result "no_recommendation"] } {
 		    
@@ -625,6 +627,7 @@
 		    ad_return_error "Sorry" "
 			<p>There has been an error in the processing of your credit card information.
 			   Please contact <a href=\"mailto:[ec_system_owner]\">[ec_system_owner]</a> to report the error.</p>"
+		    ad_script_abort
 		}
 	    }
 	}
@@ -739,6 +742,7 @@
 		ad_return_error "Sorry" "
 		    <p>There has been an error in the processing of your credit card information.
 		    Please contact <a href=\"mailto:[ec_system_owner]\">[ec_system_owner]</a> to report the error.</p>"
+		ad_script_abort
 	    }
 	}
     }
@@ -886,6 +890,7 @@
 		ad_return_error "Sorry" "
 			<p>There has been an error in the processing of your credit card information.
 			   Please contact <a href=\"mailto:[ec_system_owner]\">[ec_system_owner]</a> to report the error.</p>"
+		ad_script_abort
 	    }
 	}
     } else {
Index: openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-return-4.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-return-4.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-return-4.tcl	20 Jan 2018 22:44:04 -0000	1.2
+++ openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-return-4.tcl	21 Jan 2018 00:37:17 -0000	1.3
@@ -468,7 +468,7 @@
 	      to be reinstated was larger than the original amount used.  This shouldn't have happened unless there was a programming error
 	      or unless the database was incorrectly updated manually.</p>
 	    <p>This transaction has been aborted, i.e. no refund has been given to the customer. This has been logged in the problems log.</p>"
-	return
+	ad_script_abort
     }
 
     # Go through and reinstate certificates in order; it's not so bad
Index: openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-void-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-void-2.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-void-2.tcl	2 Sep 2008 21:54:48 -0000	1.1
+++ openacs-4/packages/dotlrn-ecommerce/www/manage/ecommerce/items-void-2.tcl	21 Jan 2018 00:37:17 -0000	1.2
@@ -107,11 +107,13 @@
 		(problem_id, problem_date, problem_details, order_id)
 		values
 		(ec_problem_id_sequence.nextval, sysdate, 'We were unable to reinstate the customer''s gift certificate balance because the amount to be reinstated was larger than the original amount used.  This shouldn''t have happened unless there was a programming error or unless the database was incorrectly updated manually.  The voiding of this order has been aborted.', :order_id)"
+
 	    ad_return_error "Gift Certificate Error" "
 		<p>We were unable to reinstate the customer's gift certificate balance because the amount to be reinstated was larger than the original amount used.  
 		  This shouldn't have happened unless there was a programming error or unless the database was incorrectly updated manually.</p>
 		<p>The voiding of this order has been aborted.  This has been logged in the problems log.</p>"
-	    return
+	    ad_script_abort
+
 	} else {
 
 	    # Go through and reinstate certificates in order; it's not
Index: openacs-4/packages/acs-admin/lib/password-update.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/lib/password-update.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/acs-admin/lib/password-update.tcl	5 Jan 2018 22:59:57 -0000	1.7
+++ openacs-4/packages/acs-admin/lib/password-update.tcl	21 Jan 2018 00:38:37 -0000	1.8
@@ -14,6 +14,7 @@
 
 if { ![auth::password::can_change_p -user_id $user_id] } {
     ad_return_error "Not supported" "Changing password is not supported."
+    ad_script_abort
 }
 
 set page_title [_ acs-subsite.Update_Password]
@@ -71,7 +72,7 @@
                 ad_script_abort
             }
 	    ad_return_error $result(password_message) ""
-	    break
+	    ad_script_abort
         }
         default {
             form set_error update password_1 $result(password_message)
Index: openacs-4/packages/acs-admin/www/apm/package-add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-add-2.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/acs-admin/www/apm/package-add-2.tcl	19 Jan 2018 13:40:40 -0000	1.15
+++ openacs-4/packages/acs-admin/www/apm/package-add-2.tcl	21 Jan 2018 00:38:38 -0000	1.16
@@ -124,9 +124,10 @@
 	if {[catch {
 	    apm_package_install_spec $version_id
 	} errmsg]} {
-	    ad_return_error "Filesystem Error" "
-	    I was unable to create your package for the following reason:
-	    <blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>"
+	    ad_return_error "Filesystem Error" \
+                "I was unable to create your package for the following reason:
+                <blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>"
+            ad_script_abort
 	}
     }
 } on_error {
@@ -137,11 +138,9 @@
 	ad_returnredirect "version-view?version_id=$version_id"
 	ad_script_abort
     }
-    ad_return_error "Database Error" "
-    I was unable to create your package for the following reason:
-
-    <blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>
-    "
+    ad_return_error "Database Error" \
+        "I was unable to create your package for the following reason:
+        <blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>"
     ad_script_abort
 }
 
Index: openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl	19 Jan 2018 13:40:40 -0000	1.9
+++ openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl	21 Jan 2018 00:38:38 -0000	1.10
@@ -36,6 +36,7 @@
     ad_return_error "Database Error" "The parameter could not be updated.  
 The database returned the following error:<p>
  <blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>"
+    ad_script_abort
 } 
 
 # LARS hack
Index: openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl	7 Aug 2017 23:47:45 -0000	1.5
+++ openacs-4/packages/acs-admin/www/auth/authority-set-enabled-p.tcl	21 Jan 2018 00:38:38 -0000	1.6
@@ -18,12 +18,12 @@
 
 if { $allowed_p } { 
     db_dml set_enabled_p { update auth_authorities set enabled_p = :enabled_p where authority_id = :authority_id }
-    
     ad_returnredirect . 
-    ad_script_abort
 } else {
-    ad_return_error "Cannot disable authority" "Disabling this authority would mean that all site-wide administrator users are shut out from the system, meaning the system could no longer be administered."
+    ad_return_error "Cannot disable authority" \
+        "Disabling this authority would mean that all site-wide administrator users are shut out from the system, meaning the system could no longer be administered."
 }
+ad_script_abort
 
 # Local variables:
 #    mode: tcl
Index: openacs-4/packages/acs-admin/www/users/member-state-change.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/member-state-change.tcl,v
diff -u -r1.20 -r1.21
--- openacs-4/packages/acs-admin/www/users/member-state-change.tcl	1 Oct 2017 12:16:05 -0000	1.20
+++ openacs-4/packages/acs-admin/www/users/member-state-change.tcl	21 Jan 2018 00:38:38 -0000	1.21
@@ -60,7 +60,7 @@
     }
 }
 
-if {[catch {
+ad_try {
     acs_user::change_state -user_id $user_id -state $member_state
 
     switch -- $email_verified_p {
@@ -71,9 +71,10 @@
             db_exec_plsql unapprove_email {}
         }
     }
-} errmsg]} {
+} on error {errorMsg} {
     ad_return_error "Database Update Failed" "Database update failed with the following error:
-    <pre>$errmsg</pre>"
+    <pre>[ns_quotehtml $errorMsg]</pre>"
+    ad_script_abort
 }
 
 callback acs_admin::member_state_change -member_state $member_state -user_id $user_id
Index: openacs-4/packages/acs-admin/www/users/user-add-3.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/user-add-3.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/acs-admin/www/users/user-add-3.tcl	11 Sep 2017 14:56:16 -0000	1.10
+++ openacs-4/packages/acs-admin/www/users/user-add-3.tcl	21 Jan 2018 00:38:38 -0000	1.11
@@ -33,7 +33,7 @@
 [ns_quotehtml $errmsg]
 </code></div>
 }]
-    return
+   ad_script_abort
 }
 
 # Local variables:
Index: openacs-4/packages/acs-admin/www/users/user-batch-add-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/users/user-batch-add-2.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/acs-admin/www/users/user-batch-add-2.tcl	7 Aug 2017 23:47:45 -0000	1.8
+++ openacs-4/packages/acs-admin/www/users/user-batch-add-2.tcl	21 Jan 2018 00:38:38 -0000	1.9
@@ -88,9 +88,8 @@
 <div><code>
 [ns_quotehtml $errmsg]
 </code></div>"
-        return
+        ad_script_abort
     }
-
 }
 
 ad_return_template
Index: openacs-4/packages/dotlrn/www/register.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/register.tcl,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/dotlrn/www/register.tcl	7 Aug 2017 23:48:09 -0000	1.18
+++ openacs-4/packages/dotlrn/www/register.tcl	21 Jan 2018 00:38:38 -0000	1.19
@@ -125,11 +125,15 @@
     } else {
         ns_log Error "register.tcl failed: $errmsg\n$::errorInfo"
         
-        ad_return_error "Error adding user to community"  "An error occurred while trying to add a user to a community.  This error has been logged."
+        ad_return_error \
+            "Error adding user to community"  \
+            "An error occurred while trying to add a user to a community.  This error has been logged."
+        ad_script_abort
     }
 }
 
 ad_returnredirect $referer
+ad_script_abort
 
 # Local variables:
 #    mode: tcl
Index: openacs-4/packages/dotlrn/www/admin/community-members-add-to-community.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/community-members-add-to-community.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/dotlrn/www/admin/community-members-add-to-community.tcl	7 Aug 2017 23:48:09 -0000	1.7
+++ openacs-4/packages/dotlrn/www/admin/community-members-add-to-community.tcl	21 Jan 2018 00:38:38 -0000	1.8
@@ -94,12 +94,12 @@
                             if {[dotlrn_community::member_p $community_id $user_id]} {
                                 # assume this was a double click
                                 ad_returnredirect $referer
-                                ad_script_abort
                             } else {
                                 ns_log Error "community-members-add-to_community.tcl failed: $errmsg"
-                                ReturnHeaders
+                                #ReturnHeaders
                                 ad_return_error "[_ dotlrn.lt_Error_adding_user_to_]"  "[_ dotlrn.lt_An_error_occurred_whil]"
                             }
+                            ad_script_abort
                         }
                     } else {
                         # they are already there and awaiting approval, so just approve them.
Index: openacs-4/packages/dotlrn/www/admin/user-new-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-new-2.tcl,v
diff -u -r1.37 -r1.38
--- openacs-4/packages/dotlrn/www/admin/user-new-2.tcl	7 Aug 2017 23:48:09 -0000	1.37
+++ openacs-4/packages/dotlrn/www/admin/user-new-2.tcl	21 Jan 2018 00:38:38 -0000	1.38
@@ -109,6 +109,8 @@
         ad_return_error \
             "Error sending mail" \
             "There was an error sending email to $email."
+        ad_script_abort
+        
     } else {
 
         set admin_subject "The following email was just sent from [ad_system_name]"
Index: openacs-4/packages/dotlrn/www/admin/users-search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/users-search.tcl,v
diff -u -r1.32 -r1.33
--- openacs-4/packages/dotlrn/www/admin/users-search.tcl	19 Jan 2018 14:38:45 -0000	1.32
+++ openacs-4/packages/dotlrn/www/admin/users-search.tcl	21 Jan 2018 00:38:38 -0000	1.33
@@ -158,8 +158,9 @@
 
     if { $join_criteria ni {and or} } {
         ad_return_error \
-            "[_ dotlrn.lt_There_was_a_bug_in_th]" \
-            "[_ dotlrn.lt_There_was_a_bug_in_th_1]"
+            [_ dotlrn.lt_There_was_a_bug_in_th] \
+            [_ dotlrn.lt_There_was_a_bug_in_th_1]
+        ad_script_abort
     }
 
     set context_bar [list [list users [_ dotlrn.Users]] [list users-search [_ dotlrn.User_Search]] [_ dotlrn.Results]]
Index: openacs-4/packages/dotlrn-admin/www/admin/community-members-add-to-community.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-admin/www/admin/community-members-add-to-community.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn-admin/www/admin/community-members-add-to-community.tcl	28 Jun 2015 12:09:34 -0000	1.2
+++ openacs-4/packages/dotlrn-admin/www/admin/community-members-add-to-community.tcl	21 Jan 2018 00:38:38 -0000	1.3
@@ -92,12 +92,14 @@
                             if {[dotlrn_community::member_p $community_id $user_id]} {
                                 # assume this was a double click
                                 ad_returnredirect $referer
-                                ad_script_abort
                             } else {
                                 ns_log Error "community-members-add-to_community.tcl failed: $errmsg"
-                                ReturnHeaders
-                                ad_return_error "[_ dotlrn.lt_Error_adding_user_to_]"  "[_ dotlrn.lt_An_error_occured_whil]"
+                                #ReturnHeaders
+                                ad_return_error \
+				    "[_ dotlrn.lt_Error_adding_user_to_]"  \
+				    "[_ dotlrn.lt_An_error_occured_whil]"
                             }
+			    ad_script_abort
                         }
                     } else {
                         # they are already there and awaiting approval, so just approve them.
Index: openacs-4/packages/dotlrn-admin/www/admin/password-update-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-admin/www/admin/password-update-2.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/dotlrn-admin/www/admin/password-update-2.tcl	28 Jun 2015 12:09:34 -0000	1.3
+++ openacs-4/packages/dotlrn-admin/www/admin/password-update-2.tcl	21 Jan 2018 00:38:38 -0000	1.4
@@ -34,28 +34,38 @@
 set email [acs_user::get_element -user_id $user_id -element email]
 
 # Send email
-if {[catch {acs_mail_lite::send -to_addr $email -from_addr $system_owner -subject $subject -body $body} errmsg]} {
-	ns_log Error "[_ dotlrn.lt_Error_sending_email_t]" $errmsg
-	ad_return_error \
-        "[_ dotlrn.Error_sending_mail]" \
-        "[_ dotlrn.lt_There_was_an_error_se]" 
-} else {
+ad_try {
+    acs_mail_lite::send \
+	-to_addr $email \
+	-from_addr $system_owner \
+	-subject $subject \
+	-body $body
+} on error {errorMsg} {
+    ns_log Error "[_ dotlrn.lt_Error_sending_email_t] $errorMsg"
+    ad_return_error \
+	"[_ dotlrn.Error_sending_mail]" \
+	"[_ dotlrn.lt_There_was_an_error_se]"
+    ad_script_abort
+}
 
-    set system_name [ad_system_name]
-    set admin_subject "[_ dotlrn.lt_The_following_email_w]"
-    set admin_message "[_ dotlrn.lt_The_following_email_w_1]"
+set system_name [ad_system_name]
+set admin_subject "[_ dotlrn.lt_The_following_email_w]"
+set admin_message "[_ dotlrn.lt_The_following_email_w_1]"
 
-
-    if {[catch {acs_mail_lite::send -to_addr $system_owner -from_addr $system_owner -subject $admin_subject -body $admin_message} errmsg]} {
-	
-	ns_log Error "Error sending email from password-update-2.tcl" $errmsg
-	ad_return_error \
-		"[_ dotlrn.Error_sending_mail]" \
-		"[_ dotlrn.lt_There_was_an_error_se_1]"
-    }
+ad_try {
+    acs_mail_lite::send \
+	-to_addr $system_owner \
+	-from_addr $system_owner \
+	-subject $admin_subject \
+	-body $admin_message
+} on error {errorMsg} {
+    ns_log Error "Error sending email from password-update-2.tcl $errorMsg"
+    ad_return_error \
+	"[_ dotlrn.Error_sending_mail]" \
+	"[_ dotlrn.lt_There_was_an_error_se_1]"
+    ad_script_abort
 }
 
-
 if {$return_url eq ""} {
     set return_url "user?user_id=$user_id"
 }
Index: openacs-4/packages/dotlrn-admin/www/admin/user-new-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-admin/www/admin/user-new-2.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/dotlrn-admin/www/admin/user-new-2.tcl	28 Jun 2015 12:09:34 -0000	1.4
+++ openacs-4/packages/dotlrn-admin/www/admin/user-new-2.tcl	21 Jan 2018 00:38:38 -0000	1.5
@@ -104,12 +104,12 @@
 	
 	ns_log Error "Error sending email from user-new-2.tcl" $errmsg
 	ad_return_error \
-        "Error sending mail" \
-        "There was an error sending email to $email."
+	    "Error sending mail" \
+	    "There was an error sending email to $email."
+	ad_script_abort
     } else {
 
 	set admin_subject "The following email was just sent from [ad_system_name]"
-
 	set admin_message "The following email was just sent from [ad_system_name]
 
 Sent by: $email_from
@@ -122,8 +122,9 @@
 	
 	    ns_log Error "Error sending email from user-new-2.tcl" $errmsg
 	    ad_return_error \
-		    "Error sending mail" \
-		    "There was an error sending email to $email."
+		"Error sending mail" \
+		"There was an error sending email to $email."
+	    ad_script_abort
 	}
 
     }
Index: openacs-4/packages/dotlrn-admin/www/admin/users-search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-admin/www/admin/users-search.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/dotlrn-admin/www/admin/users-search.tcl	28 Jun 2015 12:09:34 -0000	1.2
+++ openacs-4/packages/dotlrn-admin/www/admin/users-search.tcl	21 Jan 2018 00:38:38 -0000	1.3
@@ -65,15 +65,19 @@
     switch -exact $search_action {
         "spam" {
             ad_returnredirect [export_vars -base users-spam {{users $selected_users}}]
+	    ad_script_abort
         }
         "add_to_community" {
             ad_returnredirect [export_vars -base users-add-to-community {{users $selected_users}}]
+	    ad_script_abort
         }
         "deactivate" {
             ad_returnredirect [export_vars -base users-deactivate {{users $selected_users}}]
+	    ad_script_abort
         }
         "delete" {
             ad_returnredirect [export_vars -base users-delete {{users $selected_users}}]
+	    ad_script_abort
         }
     }
 }
@@ -149,10 +153,11 @@
     form get_values user_search \
         id type can_browse_p guest_p last_visit_greater last_visit_less name join_criteria
 
-    if {("and" ne $join_criteria ) && ("or" ne $join_criteria )} {
+    if {"and" ne $join_criteria  && "or" ne $join_criteria } {
         ad_return_error \
             "[_ dotlrn.lt_There_was_a_bug_in_th]" \
             "[_ dotlrn.lt_There_was_a_bug_in_th_1]"
+	ad_script_abort
     }
 
     set context_bar [list [list users [_ dotlrn.Users]] [list users-search [_ dotlrn.User_Search]] [_ dotlrn.Results]]
Index: openacs-4/packages/dotlrn-homework/www/toggle-homework-alert.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-homework/www/toggle-homework-alert.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn-homework/www/toggle-homework-alert.tcl	7 Aug 2017 23:48:10 -0000	1.5
+++ openacs-4/packages/dotlrn-homework/www/toggle-homework-alert.tcl	21 Jan 2018 00:38:37 -0000	1.6
@@ -34,6 +34,7 @@
 
     if { [llength $intervals] != 1 || [llength $delivery_methods] != 1 } {
         ad_return_error "[_ dotlrn-homework.lt_internal_error]" "[_ dotlrn-homework.lt_interval_or_del]"
+        ad_script_abort
     }
 
     # The get routines return a list of name/id pairs so extract the ids
Index: openacs-4/packages/news/www/preview.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/preview.tcl,v
diff -u -r1.33 -r1.34
--- openacs-4/packages/news/www/preview.tcl	20 Jan 2018 22:43:23 -0000	1.33
+++ openacs-4/packages/news/www/preview.tcl	21 Jan 2018 00:38:38 -0000	1.34
@@ -110,7 +110,7 @@
     if { [dt_interval_check $archive_date_ansi $publish_date_ansi] >= 0 } {
 	ad_return_error "[_ news.Scheduling_Error]" \
             "[_ news.lt_The_archive_date_must]"
-	return
+	ad_script_abort
     }
 
 }
Index: openacs-4/packages/rss-support/www/subscr-ae.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/subscr-ae.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/rss-support/www/subscr-ae.tcl	7 Aug 2017 23:48:29 -0000	1.9
+++ openacs-4/packages/rss-support/www/subscr-ae.tcl	21 Jan 2018 00:38:38 -0000	1.10
@@ -52,6 +52,7 @@
     ad_return_error "No implementation found for this id." "We were unable to
 process your request.  Please contact this site's technical team for
 assistance."
+    ad_script_abort
 }
 
 if { ![info exists channel_title] || $channel_title eq "" || $channel_link eq "" } {
Index: openacs-4/packages/simple-survey/www/admin/one-respondent.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simple-survey/www/admin/one-respondent.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/simple-survey/www/admin/one-respondent.tcl	10 Sep 2002 22:23:23 -0000	1.3
+++ openacs-4/packages/simple-survey/www/admin/one-respondent.tcl	21 Jan 2018 00:38:38 -0000	1.4
@@ -23,7 +23,7 @@
 
 if { !$survey_exists_p } {
     ad_return_error "Not Found" "Could not find survey #$survey_id"
-    return
+    ad_script_abort
 }
 
 # survey_name and description are now set 
@@ -32,7 +32,7 @@
 
 if { !$user_exists_p } {
     ad_return_error "Not Found" "Could not find user #$user_id"
-    return
+    ad_script_abort
 }
 
 
Index: openacs-4/packages/simple-survey/www/admin/question-swap.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simple-survey/www/admin/question-swap.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/simple-survey/www/admin/question-swap.tcl	20 Apr 2001 20:51:22 -0000	1.1
+++ openacs-4/packages/simple-survey/www/admin/question-swap.tcl	21 Jan 2018 00:38:38 -0000	1.2
@@ -27,7 +27,7 @@
 where survey_id = :survey_id
 and sort_key in (:sort_key, :next_sort_key)"
 
-    ad_returnredirect "one?[export_url_vars survey_id]"
+    ad_returnredirect [export_vars -base one {survey_id}]
 
 } on_error {
 
@@ -38,3 +38,4 @@
 </pre>
 "
 }
+ad_script_abort
Index: openacs-4/packages/photo-album/www/album-export.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/album-export.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/photo-album/www/album-export.tcl	28 Jun 2015 12:56:09 -0000	1.7
+++ openacs-4/packages/photo-album/www/album-export.tcl	21 Jan 2018 00:39:44 -0000	1.8
@@ -50,7 +50,10 @@
     
     # query all the photo and permission info with a single trip to database
     if {![db_0or1row get_photo_info {}]} {
-        ad_return_error "[_ photo-album.No_Photo]" "[_ photo-album.lt_No_Photo_was_found_fo]"
+        ad_return_error \
+	    "[_ photo-album.No_Photo]" \
+	    "[_ photo-album.lt_No_Photo_was_found_fo]"
+	ad_script_abort
     } else {
         db_1row select_object_metadata {}
 
Index: openacs-4/packages/photo-album/www/base-photo.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/base-photo.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/photo-album/www/base-photo.tcl	26 May 2017 18:05:37 -0000	1.9
+++ openacs-4/packages/photo-album/www/base-photo.tcl	21 Jan 2018 00:39:44 -0000	1.10
@@ -40,6 +40,8 @@
 # query all the photo and permission info with a single trip to database
 if {![db_0or1row get_photo_info {}]} {
     ad_return_error "[_ photo-album.No_Photo]" "[_ photo-album.lt_No_Photo_was_found_fo]"
+    ad_script_abort
+
 } else {
     set path $image_id
 
Index: openacs-4/packages/photo-album/www/photo-iconic.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-iconic.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/photo-album/www/photo-iconic.tcl	7 Aug 2014 07:59:51 -0000	1.6
+++ openacs-4/packages/photo-album/www/photo-iconic.tcl	21 Jan 2018 00:39:44 -0000	1.7
@@ -21,7 +21,10 @@
 
 # If we did not get an album ID 
 if {! $album_id } { 
-    ad_return_error "Photo Internal Error" "The photo is either not live or not in an album.  Please inform the webmaster of the error"
+    ad_return_error \
+	"Photo Internal Error" \
+	"The photo is either not live or not in an album.  Please inform the webmaster of the error"
+    ad_script_abort
 }
 
 permission::require_permission -object_id $album_id -privilege "write"
Index: openacs-4/packages/static-pages/tcl/static-pages-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/tcl/static-pages-procs.tcl,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/static-pages/tcl/static-pages-procs.tcl	12 Sep 2013 20:43:19 -0000	1.18
+++ openacs-4/packages/static-pages/tcl/static-pages-procs.tcl	21 Jan 2018 00:39:44 -0000	1.19
@@ -797,6 +797,7 @@
             } errmsg] } {
                 ad_return_error "Error reading file" \
                     "This error was encountered while reading $filename: $errmsg"
+		ad_script_abort
             } 
 
 
Index: openacs-4/packages/static-pages/www/page-visit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/www/page-visit.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/static-pages/www/page-visit.tcl	7 Aug 2014 07:30:29 -0000	1.6
+++ openacs-4/packages/static-pages/www/page-visit.tcl	21 Jan 2018 00:39:44 -0000	1.7
@@ -34,12 +34,13 @@
 
     if { ![regexp "^/packages/$package_dir/www/(.+)" $filename match url_part] } {
         ad_return_error "Error in filename" "This page has an invalid filename: '$filename'."
+	ad_script_abort
     }
     set redirect_to "[sp_package_url $package_dir]$url_part"
 
 } else {
     ad_return_error "Error in filename" "This page has an invalid filename: '$filename'."
-    return
+    ad_script_abort
 }
 
 ad_returnredirect $redirect_to
Index: openacs-4/packages/survey/www/admin/one-respondent.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/one-respondent.tcl,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/survey/www/admin/one-respondent.tcl	30 Sep 2017 18:12:53 -0000	1.8
+++ openacs-4/packages/survey/www/admin/one-respondent.tcl	21 Jan 2018 00:39:44 -0000	1.9
@@ -33,8 +33,10 @@
 set user_exists_p [db_0or1row user_name_from_id "select first_names, last_name from persons where person_id = :user_id" ]
 
 if { !$user_exists_p } {
-    ad_return_error "[_ survey.Not_Found]" "[_ survey.Could_not_find_user] #$user_id"
-    return
+    ad_return_error \
+	"[_ survey.Not_Found]" \
+	"[_ survey.Could_not_find_user] #$user_id"
+    ad_script_abort
 }
 
 set context [_ survey.One_Respondent]
Index: openacs-4/packages/survey/www/admin/respond.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/respond.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/survey/www/admin/respond.tcl	7 Aug 2017 23:48:29 -0000	1.6
+++ openacs-4/packages/survey/www/admin/respond.tcl	21 Jan 2018 00:39:44 -0000	1.7
@@ -51,8 +51,10 @@
 set user_exists_p [db_0or1row user_name_from_id "select first_names, last_name from persons where person_id = :user_id" ]
 
 if { !$user_exists_p } {
-    ad_return_error "Not Found" "Could not find user #$user_id"
-    return
+    ad_return_error \
+	"Not Found" \
+	"Could not find user #$user_id"
+    ad_script_abort
 }
 
 # XXX TODO - person name
Index: openacs-4/packages/survey/www/admin/response-drill-down.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/survey/www/admin/response-drill-down.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/survey/www/admin/response-drill-down.tcl	27 Jun 2015 20:46:15 -0000	1.6
+++ openacs-4/packages/survey/www/admin/response-drill-down.tcl	21 Jan 2018 00:39:44 -0000	1.7
@@ -33,15 +33,15 @@
 if { !$question_exists_p }  {
     db_release_unused_handles
     ad_return_error "[_ survey.lt_Survey_Question_Not_F]" "[_ survey.lt_Could_not_find_a_surv] #$question_id"
-    return
+    ad_script_abort
 }
 
 set response_exists_p [db_0or1row get_response_text ""]
 
 if { !$response_exists_p } {
     db_release_unused_handles
     ad_return_error "[_ survey.Response_Not_Found]" "[_ survey.lt_Could_not_find_the_re] #$choice_id"
-    return
+    ad_script_abort
 }
 
 # Get information of users who responded in particular manner to