Fix bug in flow finish