You have break statements in nested loops: This means that when your alpha-beta pruning triggers it only exits the inner for-loop. Have it return the value there instead.
break