Fixed template creation bug.