Fix tests and bug introduced in 541bd8aec1f67834c42bc2e5df14c1f73c569082.