In some cases you can get a NaN value for the score, which breaks everything. Fix and test all possible score elements.