fixed template dao bugs