Fix test_optimization