add truncate function for nodes