Fix problem with CID inside optimization.