Fix bug in confidence update algorithm