corrected writeDotRecursive()