You opened May's instalment, took the payment, and Jarbas marked March's as paid. That's not a bug: it's how instalments work.
A payment always goes to the oldest unpaid instalment.
It doesn't matter which instalment's screen you opened to take the money. Jarbas sorts the instalments by due date and applies the payment to the first one still outstanding.
On the instalment screen, if there are earlier instalments outstanding, you'll see in red:
2 previous pending installments
And on the payment confirmation:
"There are previous unpaid installments. This amount will be used to pay the previous installments first."
Once you see that warning, you know: the money will clear the arrears, not the instalment on screen.
It's what stops the debt turning into a mess. If each payment could pick any instalment, you'd end up with old ones outstanding forever — interest running, confusing collections, and no clarity on what the customer actually owes.
Clearing the oldest first means the debt comes down in the right order and the overdue amount disappears first.
A payment bigger than the oldest instalment cascades: it clears that one, and whatever is left goes to the next outstanding one, and so on.
In other words: to clear May's instalment, the customer has to pay March, April and May.
Before taking payment, check for the red warning on screen. If it's there, tell the customer the money will go against the arrears — and show them how much is still needed to reach the instalment they wanted to pay. Better to agree that on the spot than explain it afterwards.