handle undefined in templates; make it easier to debug