cache improvements (template handling as well), bugfixes..., all tests
pass