fixes and tweaks to Smarty processing
Merge pull request #581 from fermionic/20130112-backport-red-smarty-improvements

fixes and tweaks to Smarty processing