Bug fix on template loader