Improved the dependency check