Make optimization actually save the results