patch up control flow