fix the flow control problem