CRM-12806, error handling and functions