fix template processing