CRM-12715 fixes to backport