Fix a critical bug in payout script