Fixed procedure bug for flow control