Tweak to SmartyTemplate code

Template cache dirs were being created incorrectly on return visits to
page