Fix template minimizing issue