fix primary key in template view