fixes and tweaks to Smarty processing