Cancelled lines were sometimes visible again after adding an outstanding payment

If you added a line, cancelled it, and then added an outstanding payment, the cancelled line would sometimes become visible again.