Fix template being evaluated before variables