Fix bug in package dependency inference