fixing depthfirstsearch