Fix bugs in the way we visit all the dependencies graph for get_transitive_dependencies.