isFlow function fixed