fix opt range and thread join condition