Fix dependency graph and merging strategy