fix to reduce algorithmic complexity when deps have lots of self-referential loops