more cleanup and preview fixes CRM-12963
Merge pull request #1171 from kurund/CRM-12963

more cleanup and preview fixes CRM-12963