Fix an optimizer bug