handle sub task and branch task