Apply Matrix test fix from ea0147fe85c6f70eda31f358cb0f9e26f8eacc9d in all tests.