Merge "fix a bug that "optimize" flag is not set for sub-threads"