fix template regex a bit