Improved dependency check