fix empty file bug, fix depthfirst, clean up printlns