add flow judge and test