Fixed #3501: correct a mistake for Optimize.

Correct a mistake for Optimize.