circular dep patch

This patch contains a failing test and a fix for #4312.