fixed template bug, need to refactor to use policy