new set flag and main defect fix
Signed-off-by: dcthink <libratwo@qq.com>