fix lua error with templates