fix template variable references