improve RemoveUnneededFlows to handle flows into loops with a single entry