custom template loader + other bugfixes