write failed nodes only if there are failed nodes