fix the flow control