Add missing template. Escape some sed's better.