Fix gradient tests.