Fixing callTemplate function.