fix race condition where ->apply_payments_and_credits could double-apply in rare...