fixed error in depth first search