Fixed an optimizer bug