Escape template var properly