fixed the control flow method