dyn_cast stuff for flow functions too