Fix gradient tests