Improved the dependency checking