fix bugs in getTemplate, improved performance

There was a couple of bugs, slowing performance when AUTO_RELOAD is enabled.
I implemented additional test in benchmark.
Before bugfix:
```
Testing 1000 separate renderings...
 smarty3: stress test                4.5818 sec,        3.7 MiB
   fenom: stress test                6.2719 sec,       14.4 MiB
```
After bugfix:
```
Testing 1000 separate renderings...
 smarty3: stress test                4.6136 sec,        3.7 MiB
   fenom: stress test                3.5603 sec,       12.5 MiB
```