add some debugging code to templateS