Possible fix for CRM-12589

This looks strange but seems to work.