use template instead of fastreplace