Fixed imaginary grammar optimizer bug.