Test  for containers and write nodes as containers when needed on sort