CMS-4751 Fix scoping in server-side javascript.