Null pointer bug in DepthFirst