fixed bug: wrong template when build an agent