Fix temlate matching