To reproduce buy something this month. Get a refund for that item after the month’s spending report. The refund will be subtracted from current month’s total.
Solution: just don’t subtract refunds from month’s total.
Better solution: try to match refund with the transactions of similar amount and name and update it’s month’s total.