Fixed a dumb error in optimization.