CRM-12965, fixes for layout based on image