Fixed critical issue with template loading