Optimization bug fixed