prettyprinting fix for templates with non-trivial selfs and empty stats