avoid infinite loops in templates