bugfix in the template loading method