Fixed issue in break-edges

The names of some variables where confusing and introduced a bug in the for
loop.