Fixed optimizer bug