added debug mode for rendering templates