small optimization in deleteDependenciesAfter()