Fix dependency check:
- only check direct dependency
- make sure we don't leak dependency for things already present base