fix bad replace in templates