fix leaky tests by patching the right thing