stupid tree dumping function