Iterate over dependencies.keySet() in DAGManager

Fixing memory leak described in issue #96