Fix a little bug in nextChipCost function