Some bug fixes related to new smarty caching system.
Some performane fixes