fixed bug with optimize flag
fixed bug with optimize flag