key_commit: Fixed the apply refund to limit the apply amount to the amount due.