revert 1960e708db06c2047d7f605d4fea1493acd97a46, but with test fix