Fix infinite recursion for cyclic deps (#13)

This is fixes the issue that I reported in #13 ("Infinite recursion error when packages have a circular dependency").