Optimizer: fix bug in return status