When one has more than one Aces, it seemed all Aces were counted as 1. This make the hand 4 A A 5 only worth 11 instead of 21 pts.
The culprit is probably that when hand value >21 your script loop through every card with value == 11 and reduce to 1. Stop the loop when the first is found and reduced, and recalculate from start may fix the problem at a cost of efficiency.
When one has more than one Aces, it seemed all Aces were counted as 1. This make the hand 4 A A 5 only worth 11 instead of 21 pts.
The culprit is probably that when hand value >21 your script loop through every card with value == 11 and reduce to 1. Stop the loop when the first is found and reduced, and recalculate from start may fix the problem at a cost of efficiency.