Fixed bug in template model;